mirror of
https://github.com/pablorevilla-meshtastic/meshview.git
synced 2026-08-05 16:33:30 +02:00
fix location of edges now that the node is in a different spot
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user