Restructure the map controls from MapLibre corner buttons into a left sidebar of icons with flyouts/panels (radar, GPX, GNSS), matching OsmAnd's layout more closely: - Base map and GPX selection are now full-height side panels docked next to the sidebar (not small dropdown flyouts or a right-docked panel), opening/closing exclusively via a small shared event bus (panels.js) so only one is ever open at a time. - The GPX panel's upload/new-folder controls are now icon buttons in the header instead of an always-visible dropzone and form; dragging a GPX file onto the tree, a specific folder, or straight onto the map itself all upload it. - New: Maptool::GpsdClient (lib/maptool/gpsd_client.rb) streams live GNSS fixes from a local gpsd daemon over Server-Sent Events (/api/gnss/stream) to a marker on the map (public/js/gnss.js) — one background gpsd connection shared by every browser tab. - The online map style (public/js/osmand-style.js) is now styled to resemble OsmAnd's own rendering, applied to both the online and offline (PMTiles) styles. Also adds a GeolocateControl (browser geolocation) next to the zoom controls.
18 lines
596 B
JavaScript
18 lines
596 B
JavaScript
// 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();
|
|
}
|
|
});
|
|
}
|