[TASK] Dynamically select maxLayerZoom
Fixes clients/names being hidden accidentally (in certain conditions). Also added auto-zoom-out to ensure zoom is in bounds
This commit is contained in:
parent
ffbd9e0fbf
commit
fa9a29e0fa
@ -301,12 +301,14 @@ define(["map/clientlayer", "map/labelslayer",
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
layers[0].layer.addTo(map);
|
||||
|
||||
layers.forEach(function (d) {
|
||||
baseLayers[d.name] = d.layer;
|
||||
});
|
||||
|
||||
|
||||
map.on("locationfound", locationFound);
|
||||
map.on("locationerror", locationError);
|
||||
map.on("dragend", saveView);
|
||||
@ -348,13 +350,11 @@ define(["map/clientlayer", "map/labelslayer",
|
||||
labelsLayer.addTo(map);
|
||||
labelsLayer.setZIndex(6);
|
||||
|
||||
map.on("baselayerchange", function (e) {
|
||||
map.on("baselayerchange", function(e) {
|
||||
map.options.maxZoom = e.layer.options.maxZoom;
|
||||
clientLayer.options.maxZoom = map.options.maxZoom;
|
||||
labelsLayer.options.maxZoom = map.options.maxZoom;
|
||||
if (map.getZoom() > map.options.maxZoom) {
|
||||
map.setZoom(map.options.maxZoom);
|
||||
}
|
||||
if (map.getZoom() > map.options.maxZoom) map.setZoom(map.options.maxZoom);
|
||||
if (localStorageTest()) {
|
||||
localStorage.setItem("map/selectedLayer", JSON.stringify({name: e.name}));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user