X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/33b7903c799c4f945e1b0e708587b70360cb0e74..b1dae2e7988d5e808b1716eb331d359575e829e5:/app/assets/javascripts/leaflet.layers.js?ds=sidebyside diff --git a/app/assets/javascripts/leaflet.layers.js b/app/assets/javascripts/leaflet.layers.js index e8014ac47..edcbfbd4d 100644 --- a/app/assets/javascripts/leaflet.layers.js +++ b/app/assets/javascripts/leaflet.layers.js @@ -64,16 +64,20 @@ L.OSM.layers = function(options) { function shown() { miniMap.invalidateSize(); - setView(); - map.on('moveend', setView); + setView({animate: false}); + map.on('moveend', moved); } function hide() { - map.off('moveend', setView); + map.off('moveend', moved); + } + + function moved() { + setView(); } - function setView() { - miniMap.setView(map.getCenter(), Math.max(map.getZoom() - 2, 0)); + function setView(options) { + miniMap.setView(map.getCenter(), Math.max(map.getZoom() - 2, 0), options); } });