diff --git a/public/js/map.js b/public/js/map.js index c074cd8..ec85c41 100644 --- a/public/js/map.js +++ b/public/js/map.js @@ -600,7 +600,8 @@ fetch("/api/kiwix") .then(({ available }) => overlaysControl.setWikiAvailable(available)) .catch(() => {}); -// Alt+click anywhere shows every rendered feature at that point — base map +// Alt+click, right click or a long press (touch browsers fire +// contextmenu for it) anywhere shows every rendered feature at that point — base map // (OSM tags via OpenFreeMap/protomaps), GPX/FIT layers, radar, all of it — // with its raw properties, inspired by NPMap4's infoboxControl (a generic // "show me everything here" debug view, kept separate from the curated @@ -610,9 +611,7 @@ fetch("/api/kiwix") // something replacing the normal popups). No dedicated UI for this // deliberately — a keyboard-modified click needs no button, state, or // cursor change of its own. -map.on("click", (event) => { - if (!event.originalEvent.altKey) return; - +const inspect = (event) => { const features = map.queryRenderedFeatures(event.point); if (features.length === 0) return; @@ -626,6 +625,11 @@ map.on("click", (event) => { .join(""); new Popup({ maxWidth: "320px", className: "debug-popup" }).setLngLat(event.lngLat).setHTML(html).addTo(map); +}; +map.on("click", (event) => event.originalEvent.altKey && inspect(event)); +map.on("contextmenu", (event) => { + event.originalEvent.preventDefault(); + inspect(event); }); // Feature properties can come straight from an uploaded GPX/FIT file (an