app: disable pointer events on popup unless it is frozen (#537)

This commit is contained in:
Jake Low
2025-03-18 18:52:10 -07:00
committed by GitHub
parent 90a6a2af3c
commit 538dc3a530
2 changed files with 9 additions and 0 deletions

View File

@@ -460,6 +460,9 @@ function MaplibreMap(props: { file: PMTiles; mapHashPassed: boolean }) {
}); });
map.on("click", (e) => { map.on("click", (e) => {
popupFrozen
? popup.removeClassName("frozen")
: popup.addClassName("frozen");
setPopupFrozen((p) => !p); setPopupFrozen((p) => !p);
}); });

View File

@@ -61,4 +61,10 @@ export const globalStyles = globalCss({
color: "$white", color: "$white",
fontFamily: "sans-serif", fontFamily: "sans-serif",
}, },
".maplibregl-popup .maplibregl-popup-content": {
pointerEvents: "none",
},
".maplibregl-popup.frozen .maplibregl-popup-content": {
pointerEvents: "auto",
},
}); });