L.OSM.sidebar = function(selector) {
var control = {},
sidebar = $(selector),
- current = $();
+ current = $(),
+ map;
+
+ control.addTo = function (_) {
+ map = _;
+ return control;
+ };
control.addPane = function(pane) {
pane
};
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');