Skip to content

Commit

Permalink
Neighbour lines pretty
Browse files Browse the repository at this point in the history
  • Loading branch information
KomelT committed Aug 28, 2024
1 parent 3213e9f commit 0fcba66
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions app/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4820,15 +4820,14 @@ <h2 class="font-bold">
}
}

for (var node of updatedNodes) {
for (const [i, node] of updatedNodes.entries()) {
// find current node
const currentNode = findNodeMarkerById(node.node_id);
if (!currentNode) {
continue;
}

// add node neighbours
var polylineOffset = 0;
const neighbours = node.neighbours ?? [];
for (const neighbour of neighbours) {
// fixme: skipping zero snr? saw some crazy long neighbours with zero snr...
Expand All @@ -4841,6 +4840,13 @@ <h2 class="font-bold">
continue;
}

const neighbourI = updatedNodes.findIndex(
(el) => el.node_id === neighbourNode.node_id
);

if (neighbourI === -1) polylineOffset = 0;
else polylineOffset = 2.5;

const neighbourNodeMarker = findNodeMarkerById(neighbour.node_id);
if (neighbourNodeMarker) {
// calculate distance in meters between nodes (rounded to 2 decimal places)
Expand Down Expand Up @@ -4868,9 +4874,6 @@ <h2 class="font-bold">
}
).addTo(neighboursLayerGroup);

// increase offset so next neighbour does not overlay other neighbours from self
polylineOffset += 2;

// default to showing distance in meters
var distance = `${distanceInMeters} meters`;

Expand Down

0 comments on commit 0fcba66

Please sign in to comment.