Map: highlight pin when navigated from packet detail

Red circle marker with tooltip at the target coordinates,
fades out after 10 seconds. Makes it obvious where the
packet location is on the map.
This commit is contained in:
you committed 2026-03-22 22:47:01 +00:00
1 parent 115c65bea4
commit 333d1cf7eb
2 files changed
+11 -1

No files matched your search

+1 -1
View File
@@ -86,7 +86,7 @@
<script src="app.js?v=1774126708"></script>
<script src="home.js?v=1774042199"></script>
<script src="packets.js?v=1774219409"></script>
<script src="map.js?v=1774219409" onerror="console.error('Failed to load:', this.src)"></script>
<script src="map.js?v=1774219621" onerror="console.error('Failed to load:', this.src)"></script>
<script src="channels.js?v=1774331200" onerror="console.error('Failed to load:', this.src)"></script>
<script src="nodes.js?v=1774218049" onerror="console.error('Failed to load:', this.src)"></script>
<script src="traces.js?v=1774135052" onerror="console.error('Failed to load:', this.src)"></script>
+10
View File
@@ -139,6 +139,16 @@
}
map = L.map('leaflet-map', { zoomControl: true }).setView(initCenter, initZoom);
// Drop a highlight pin if navigated from a packet detail link
if (urlParams.get('lat') && urlParams.get('lon')) {
const pinLat = parseFloat(urlParams.get('lat'));
const pinLon = parseFloat(urlParams.get('lon'));
const pin = L.circleMarker([pinLat, pinLon], { radius: 12, color: '#ef4444', fillColor: '#ef4444', fillOpacity: 0.3, weight: 2 }).addTo(map);
pin.bindTooltip(`${pinLat.toFixed(4)}, ${pinLon.toFixed(4)}`, { permanent: true, direction: 'top', offset: [0, -10] });
// Fade out pin after 10 seconds
setTimeout(() => { map.removeLayer(pin); }, 10000);
}
const isDark = document.documentElement.getAttribute('data-theme') === 'dark' ||
(document.documentElement.getAttribute('data-theme') !== 'light' && window.matchMedia('(prefers-color-scheme: dark)').matches);
const tileLayer = L.tileLayer(isDark ? TILE_DARK : TILE_LIGHT, {