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