X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/33b7903c799c4f945e1b0e708587b70360cb0e74..366fb80ddb401fde376515dd12f51e281afe62da:/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..a364588c1 100644
--- a/app/assets/javascripts/leaflet.layers.js
+++ b/app/assets/javascripts/leaflet.layers.js
@@ -7,7 +7,7 @@ L.OSM.layers = function(options) {
var $container = $('
')
.attr('class', 'control-layers');
- var link = $('
')
+ var button = $('')
.attr('class', 'control-button')
.attr('href', '#')
.attr('title', 'Layers')
@@ -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);
}
});
@@ -152,7 +156,7 @@ L.OSM.layers = function(options) {
function toggle(e) {
e.stopPropagation();
e.preventDefault();
- options.sidebar.togglePane($ui);
+ options.sidebar.togglePane($ui, button);
}
return $container[0];