]> git.openstreetmap.org Git - rails.git/blobdiff - app/assets/javascripts/leaflet.sidebar.js
Add option to include marker in permalinks
[rails.git] / app / assets / javascripts / leaflet.sidebar.js
index f75cc29fe33f262539b1a12e53726f66cf26f5b4..8c4dee308ada2bb36068aaf2f7fe430a9501279c 100644 (file)
@@ -1,7 +1,13 @@
 L.OSM.sidebar = function(selector) {
   var control = {},
     sidebar = $(selector),
 L.OSM.sidebar = function(selector) {
   var control = {},
     sidebar = $(selector),
-    current = $();
+    current = $(),
+    map;
+
+  control.addTo = function (_) {
+    map = _;
+    return control;
+  };
 
   control.addPane = function(pane) {
     pane
 
   control.addPane = function(pane) {
     pane
@@ -10,22 +16,20 @@ L.OSM.sidebar = function(selector) {
   };
 
   control.togglePane = function(pane) {
   };
 
   control.togglePane = function(pane) {
-    var controlContainer = $('.leaflet-control-container .leaflet-top.leaflet-right');
-
     current
       .hide()
       .trigger('hide');
 
     if (current === pane) {
       $(sidebar).hide();
     current
       .hide()
       .trigger('hide');
 
     if (current === pane) {
       $(sidebar).hide();
-      controlContainer.css({paddingRight: '0'});
       current = $();
     } else {
       $(sidebar).show();
       current = $();
     } else {
       $(sidebar).show();
-      controlContainer.css({paddingRight: '250px'});
       current = pane;
     }
 
       current = pane;
     }
 
+    map.invalidateSize({pan: false, animate: false});
+
     current
       .show()
       .trigger('show');
     current
       .show()
       .trigger('show');