mirror of
https://github.com/pablorevilla-meshtastic/meshview.git
synced 2026-03-04 23:27:46 +01:00
Added the traceroute and neighbours to the map
This commit is contained in:
@@ -205,19 +205,25 @@ function loadEdges(callback) {
|
||||
}
|
||||
|
||||
function onNodeClick(node) {
|
||||
console.log(`Clicked node ${node.long_name}: lat=${node.lat}, long=${node.long}`);
|
||||
|
||||
loadEdges(edges => {
|
||||
edgeLayer.clearLayers();
|
||||
edges.forEach(edge => {
|
||||
// Only consider edges connected to the clicked node
|
||||
// Only draw edges connected to the clicked node
|
||||
if (edge.from !== node.id && edge.to !== node.id) return;
|
||||
|
||||
let fromNode = nodes.find(n => n.id === edge.from);
|
||||
let toNode = nodes.find(n => n.id === edge.to);
|
||||
|
||||
// Validate coordinates
|
||||
if (fromNode && toNode && fromNode.lat != null && fromNode.long != null &&
|
||||
toNode.lat != null && toNode.long != null) {
|
||||
|
||||
// Determine the "other" node
|
||||
let otherNode = edge.from === node.id ? toNode : fromNode;
|
||||
console.log(` Connected to node ${otherNode.long_name}: lat=${otherNode.lat}, long=${otherNode.long}`);
|
||||
|
||||
// Draw the edge
|
||||
L.polyline(
|
||||
[[fromNode.lat, fromNode.long], [toNode.lat, toNode.long]],
|
||||
{
|
||||
@@ -233,6 +239,7 @@ function onNodeClick(node) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Attach edge click events
|
||||
nodes.forEach(node => {
|
||||
if (node.lat != null && node.long != null) {
|
||||
|
||||
Reference in New Issue
Block a user