Zoom out when switching to a layer with a lower maxZoom

This commit is contained in:
Tom Hughes 2013-09-23 17:29:07 +01:00
parent 3ba48b313a
commit 4e214746c6

View file

@ -73,6 +73,12 @@ $(document).ready(function () {
updateLayers(OSM.mapParams());
});
map.on("baselayerchange", function (e) {
if (map.getZoom() > e.layer.options.maxZoom) {
map.setView(map.getCenter(), e.layer.options.maxZoom, { reset: true });
}
});
map.noteLayer = new L.LayerGroup();
map.noteLayer.options = {code: 'N'};