[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:
Marvin W 2016-05-22 12:30:31 +02:00 committed by Xaver Maierhofer
parent ffbd9e0fbf
commit fa9a29e0fa

View File

@ -301,12 +301,14 @@ define(["map/clientlayer", "map/labelslayer",
}; };
}); });
layers[0].layer.addTo(map); layers[0].layer.addTo(map);
layers.forEach(function (d) { layers.forEach(function (d) {
baseLayers[d.name] = d.layer; baseLayers[d.name] = d.layer;
}); });
map.on("locationfound", locationFound); map.on("locationfound", locationFound);
map.on("locationerror", locationError); map.on("locationerror", locationError);
map.on("dragend", saveView); map.on("dragend", saveView);
@ -352,9 +354,7 @@ define(["map/clientlayer", "map/labelslayer",
map.options.maxZoom = e.layer.options.maxZoom; map.options.maxZoom = e.layer.options.maxZoom;
clientLayer.options.maxZoom = map.options.maxZoom; clientLayer.options.maxZoom = map.options.maxZoom;
labelsLayer.options.maxZoom = map.options.maxZoom; labelsLayer.options.maxZoom = map.options.maxZoom;
if (map.getZoom() > map.options.maxZoom) { if (map.getZoom() > map.options.maxZoom) map.setZoom(map.options.maxZoom);
map.setZoom(map.options.maxZoom);
}
if (localStorageTest()) { if (localStorageTest()) {
localStorage.setItem("map/selectedLayer", JSON.stringify({name: e.name})); localStorage.setItem("map/selectedLayer", JSON.stringify({name: e.name}));
} }