From 03c8215342a084a2ec813cddfa7cca2a50a9a130 Mon Sep 17 00:00:00 2001 From: liamcottle Date: Wed, 13 Mar 2024 03:53:19 +1300 Subject: [PATCH] improve finding nodes --- src/public/index.html | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/public/index.html b/src/public/index.html index 3f75bfd..464276e 100644 --- a/src/public/index.html +++ b/src/public/index.html @@ -347,9 +347,19 @@ // otherwise search nodes on map for(var node of nodes){ - // find by id - if(node.id.toString().toLowerCase() === search.toLowerCase()){ - return node.id; + // find by node_id + if(node.node_id.toString().toLowerCase() === search.toLowerCase()){ + return node.node_id; + } + + // find by node_id_hex + if(node.node_id_hex.toString().toLowerCase() === search.toLowerCase()){ + return node.node_id; + } + + // find by node_id_hex (without "!") + if(node.node_id_hex.toString().toLowerCase().replaceAll("!", "") === search.toLowerCase()){ + return node.node_id; } } @@ -503,7 +513,7 @@ // create node marker var marker = L.marker([node.latitude, node.longitude], { icon: icon, - tagName: node.id, + tagName: node.node_id, }) .bindTooltip(tooltip, { interactive: true, @@ -517,7 +527,7 @@ // add to cache nodes.push(node); - nodeMarkers[node.id] = marker; + nodeMarkers[node.node_id] = marker; }