Zoom out when switching to a layer with a lower maxZoom
This commit is contained in:
parent
3ba48b313a
commit
4e214746c6
1 changed files with 6 additions and 0 deletions
|
@ -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'};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue