]> git.openstreetmap.org Git - rails.git/blobdiff - app/assets/javascripts/leaflet.sidebar.js
Update hash on P2 and iD edit pages and throttle
[rails.git] / app / assets / javascripts / leaflet.sidebar.js
index a6529ad0087d35ded17371569444fb6cfa3c2dac..8c4dee308ada2bb36068aaf2f7fe430a9501279c 100644 (file)
@@ -1,7 +1,13 @@
 L.OSM.sidebar = function(selector) {
   var control = {},
     sidebar = $(selector),
-    current = $();
+    current = $(),
+    map;
+
+  control.addTo = function (_) {
+    map = _;
+    return control;
+  };
 
   control.addPane = function(pane) {
     pane
@@ -10,22 +16,20 @@ L.OSM.sidebar = function(selector) {
   };
 
   control.togglePane = function(pane) {
-    var controlContainer = $('.leaflet-control-container .leaflet-top.leaflet-right');
-
     current
       .hide()
       .trigger('hide');
 
     if (current === pane) {
       $(sidebar).hide();
-      controlContainer.css({paddingRight: '0'});
       current = $();
     } else {
       $(sidebar).show();
-      controlContainer.css({paddingRight: '200px'});
       current = pane;
     }
 
+    map.invalidateSize({pan: false, animate: false});
+
     current
       .show()
       .trigger('show');