From f1c2b22821ac6862753831a3dd0010936b6f79f3 Mon Sep 17 00:00:00 2001 From: Roman Priesol Date: Tue, 24 Nov 2026 21:21:15 +0100 Subject: [PATCH] Feature inspector also on right click and long press (touch browsers fire contextmenu), not only Alt+click --- public/js/map.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) 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