From 9aacceda2843e32d368e2857346b682d27c086b1 Mon Sep 17 00:00:00 2001 From: pablorevilla-meshtastic Date: Thu, 12 Feb 2026 13:29:51 -0800 Subject: [PATCH] fix location of edges now that the node is in a different spot --- meshview/templates/map.html | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/meshview/templates/map.html b/meshview/templates/map.html index 73052fc..e55d05b 100644 --- a/meshview/templates/map.html +++ b/meshview/templates/map.html @@ -231,6 +231,14 @@ function isInvalidCoord(n){ Number.isNaN(n.lat) || Number.isNaN(n.long); } +function getNodeLatLng(n){ + const marker = markerById[n.key]; + if(marker){ + return marker.getLatLng(); + } + return { lat: n.lat, lng: n.long }; +} + /* ====================================================== PACKET FETCHING (unchanged) ====================================================== */ @@ -515,7 +523,9 @@ async function onNodeClick(node){ if(!f || !t || isInvalidCoord(f) || isInvalidCoord(t)) return; const color = edge.type === "neighbor" ? "gray" : "orange"; - const line = L.polyline([[f.lat, f.long], [t.lat, t.long]], { + const fLatLng = getNodeLatLng(f); + const tLatLng = getNodeLatLng(t); + const line = L.polyline([[fLatLng.lat, fLatLng.lng], [tLatLng.lat, tLatLng.lng]], { color, weight: 3 }).addTo(edgeLayer);