X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/c8fb5ad24c5751bd2d43b86e4359381d200af066..a3d69ee264f234ee85990b20e421b7cee8baa669:/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); } });