Feature inspector also on right click and long press (touch browsers fire contextmenu), not only Alt+click
CI / check (push) Successful in 8m50s
CI / deploy (push) Successful in 17s

This commit is contained in:
randy committed 2026-11-24 21:21:15 +01:00
1 parent b98a3ebcf1
commit f1c2b22821
1 file changed
+8 -4
+8 -4
View File
@@ -600,7 +600,8 @@ fetch("/api/kiwix")
.then(({ available }) => overlaysControl.setWikiAvailable(available)) .then(({ available }) => overlaysControl.setWikiAvailable(available))
.catch(() => {}); .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 — // (OSM tags via OpenFreeMap/protomaps), GPX/FIT layers, radar, all of it —
// with its raw properties, inspired by NPMap4's infoboxControl (a generic // with its raw properties, inspired by NPMap4's infoboxControl (a generic
// "show me everything here" debug view, kept separate from the curated // "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 // something replacing the normal popups). No dedicated UI for this
// deliberately — a keyboard-modified click needs no button, state, or // deliberately — a keyboard-modified click needs no button, state, or
// cursor change of its own. // cursor change of its own.
map.on("click", (event) => { const inspect = (event) => {
if (!event.originalEvent.altKey) return;
const features = map.queryRenderedFeatures(event.point); const features = map.queryRenderedFeatures(event.point);
if (features.length === 0) return; if (features.length === 0) return;
@@ -626,6 +625,11 @@ map.on("click", (event) => {
.join(""); .join("");
new Popup({ maxWidth: "320px", className: "debug-popup" }).setLngLat(event.lngLat).setHTML(html).addTo(map); 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 // Feature properties can come straight from an uploaded GPX/FIT file (an