]> git.openstreetmap.org Git - rails.git/blobdiff - app/assets/javascripts/leaflet.layers.js
Update Potlatch 2 to 2.3-603-gebdfa12 build
[rails.git] / app / assets / javascripts / leaflet.layers.js
index e5fbdf7c83a7cc19ad0d3984b7f9558e51014b39..a364588c1dfe073f7778f0390df016b9bdc488fc 100644 (file)
@@ -7,7 +7,7 @@ L.OSM.layers = function(options) {
     var $container = $('<div>')
       .attr('class', 'control-layers');
 
-    var link = $('<a>')
+    var button = $('<a>')
       .attr('class', 'control-button')
       .attr('href', '#')
       .attr('title', 'Layers')
@@ -35,10 +35,6 @@ L.OSM.layers = function(options) {
       .attr('class', 'section base-layers')
       .appendTo($ui);
 
-    $('<p>')
-      .text(I18n.t('javascripts.map.layers.base'))
-      .appendTo(baseSection);
-
     list = $('<ul>')
       .appendTo(baseSection);
 
@@ -68,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);
         }
       });
 
@@ -156,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];