diff --git a/src/public/index.html b/src/public/index.html index 4362832..18b1144 100644 --- a/src/public/index.html +++ b/src/public/index.html @@ -188,7 +188,7 @@ Devices - + + +
+ + + + +
+ +
@@ -772,16 +783,98 @@
+ +
+ + + @@ -1442,6 +1540,9 @@ // clear nodes cache nodes = []; + // get config + const configNeighboursMaxDistanceInMeters = getConfigNeighboursMaxDistanceInMeters(); + // add nodes for(var node of updatedNodes){ @@ -1533,6 +1634,15 @@ const neighbourNodeMarker = findNodeMarkerById(neighbour.node_id); if(neighbourNodeMarker){ + // calculate distance in meters between nodes (rounded to 2 decimal places) + const distanceInMeters = currentNode.getLatLng().distanceTo(neighbourNodeMarker.getLatLng()).toFixed(2); + + // don't show this neighbour connection if further than config allows + if(configNeighboursMaxDistanceInMeters != null && parseFloat(distanceInMeters) > configNeighboursMaxDistanceInMeters){ + continue; + } + + // add neighbour line to map const line = L.polyline([ currentNode.getLatLng(), neighbourNodeMarker.getLatLng(), @@ -1541,9 +1651,6 @@ opacity: 0.5, }).addTo(neighboursLayerGroup); - // calculate distance in meters between nodes (rounded to 2 decimal places) - const distanceInMeters = currentNode.getLatLng().distanceTo(neighbourNodeMarker.getLatLng()).toFixed(2); - // default to showing distance in meters var distance = `${distanceInMeters} meters`;