// Keeps at most one full-height side panel (base map, GPX, ...) open at a // time — they all dock to the same spot next to the sidebar, so two open // together would just stack on top of each other. const OPEN_EVENT = "side-panel-open"; export function notifySidePanelOpen(panel) { document.dispatchEvent(new CustomEvent(OPEN_EVENT, { detail: panel })); } export function onlyOneSidePanelOpen(panel, onClosedByOther) { document.addEventListener(OPEN_EVENT, (event) => { if (event.detail !== panel && !panel.hidden) { panel.hidden = true; onClosedByOther(); } }); }