1 L.OSM.sidebar = function (selector) {
8 control.addTo = function (_) {
13 control.addPane = function (pane) {
19 control.togglePane = function (pane, button) {
20 const mediumDeviceWidth = window.getComputedStyle(document.documentElement).getPropertyValue("--bs-breakpoint-md");
21 const isMediumDevice = window.matchMedia(`(max-width: ${mediumDeviceWidth})`).matches;
22 const paneWidth = 250;
30 .removeClass("active");
32 if (current === pane) {
34 $("#content").addClass("overlay-right-sidebar");
35 current = currentButton = $();
37 map.panBy([0, -$("#map").height() / 2], { animate: false });
38 } else if ($("html").attr("dir") === "rtl") {
39 map.panBy([-paneWidth, 0], { animate: false });
43 $("#content").removeClass("overlay-right-sidebar");
45 currentButton = button || $();
47 map.panBy([0, $("#map").height()], { animate: false });
48 } else if ($("html").attr("dir") === "rtl") {
49 map.panBy([paneWidth, 0], { animate: false });
53 map.invalidateSize({ pan: false, animate: false });
64 sidebar.find(".sidebar-close-controls button").on("click", () => {
65 control.togglePane(current, currentButton);