X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/6db326aa1f084a062a3b658876bc01bf650f5702..a64b7237ec06264d26385e1384c3130bcbccd446:/app/assets/javascripts/leaflet.sidebar.js diff --git a/app/assets/javascripts/leaflet.sidebar.js b/app/assets/javascripts/leaflet.sidebar.js index bb046f99a..9573c839d 100644 --- a/app/assets/javascripts/leaflet.sidebar.js +++ b/app/assets/javascripts/leaflet.sidebar.js @@ -1,9 +1,9 @@ L.OSM.sidebar = function (selector) { var control = {}, - sidebar = $(selector), - current = $(), - currentButton = $(), - map; + sidebar = $(selector), + current = $(), + currentButton = $(), + map; control.addTo = function (_) { map = _; @@ -17,6 +17,8 @@ L.OSM.sidebar = function (selector) { }; control.togglePane = function (pane, button) { + var paneWidth = 250; + current .hide() .trigger("hide"); @@ -25,12 +27,20 @@ L.OSM.sidebar = function (selector) { .removeClass("active"); if (current === pane) { + if ($("html").attr("dir") === "rtl") { + map.panBy([-paneWidth, 0], { animate: false }); + } $(sidebar).hide(); + $("#content").addClass("overlay-right-sidebar"); current = currentButton = $(); } else { $(sidebar).show(); + $("#content").removeClass("overlay-right-sidebar"); current = pane; currentButton = button || $(); + if ($("html").attr("dir") === "rtl") { + map.panBy([paneWidth, 0], { animate: false }); + } } map.invalidateSize({ pan: false, animate: false });