X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/33b7903c799c4f945e1b0e708587b70360cb0e74..606e66beb32d2b683651cf9ac7ae575d90df7ad6:/app/assets/javascripts/leaflet.layers.js?ds=inline 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); } });