diff --git a/meshview/templates/map.html b/meshview/templates/map.html index bf7e07a..b1aa75b 100644 --- a/meshview/templates/map.html +++ b/meshview/templates/map.html @@ -248,6 +248,7 @@ var trafficHeatLoaded = false; var trafficHeatLoading = false; const UNMAPPED_LIMIT = 50; const UNMAPPED_TTL_MS = 5000; +const PACKET_SEEN_DELAY_MS = 3000; const portMap = window.PORT_LABEL_MAP; @@ -408,7 +409,7 @@ function fetchNewPackets(){ } else { addUnmappedPacket(pkt, nodeData); } - showPacketSeenNodes(pkt); + schedulePacketSeenNodes(pkt); }); lastImportTime = latest; @@ -790,6 +791,13 @@ function clearPacketSeenHighlights(){ packetSeenLayer.clearLayers(); } +function schedulePacketSeenNodes(pkt){ + if(!map.hasLayer(packetSeenLayer) || pkt.id == null) return; + + const timeout = setTimeout(() => showPacketSeenNodes(pkt), PACKET_SEEN_DELAY_MS); + activePacketSeenHighlights.push(timeout); +} + async function showPacketSeenNodes(pkt){ if(!map.hasLayer(packetSeenLayer) || pkt.id == null) return;