frontend: Ghost-in-the-Shell overhaul — map-first landing, event blips, tickers #1
1 changed files with 15 additions and 4 deletions
|
|
@ -1621,11 +1621,22 @@ async function initMap() {
|
|||
if (activeHls) { try { activeHls.destroy(); } catch (_) {} activeHls = null; }
|
||||
});
|
||||
updateHeatLegend();
|
||||
// Reload overlays when the user pans/zooms. Skip when a popup is open:
|
||||
// opening a camera popup auto-pans the map to fit it, and that moveend
|
||||
// must NOT rebuild the marker group under the open popup.
|
||||
// Reload overlays when the user pans/zooms. A live popup makes the
|
||||
// rebuild skip (so the popup's autopan doesn't destroy it), but user
|
||||
// zoom/drag must close the popup FIRST — otherwise zooming out with a
|
||||
// camera popup open leaves the stale, zoomed-in marker group on the
|
||||
// map and the cameras "vanish" until a refresh.
|
||||
//
|
||||
// NOTE: `map._popup` is NOT a reliable open-check in Leaflet 1.9.4 —
|
||||
// Map.closePopup() never nulls it, so once any popup has been opened
|
||||
// it stays truthy forever. Track the real state via popupopen/close.
|
||||
let camPopupOpen = false;
|
||||
map.on('popupopen', () => { camPopupOpen = true; });
|
||||
map.on('popupclose', () => { camPopupOpen = false; });
|
||||
map.on('zoomstart', () => { if (camPopupOpen) map.closePopup(); });
|
||||
map.on('dragstart', () => { if (camPopupOpen) map.closePopup(); });
|
||||
map.on('moveend', () => {
|
||||
if (map._popup) return;
|
||||
if (camPopupOpen) return; // only the popup's own autopan now
|
||||
if (firesOn) loadFires();
|
||||
if (camsOn) loadCams();
|
||||
if (blipsOn) loadBlips();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue