diff --git a/src/public/index.html b/src/public/index.html index 4dffd8c..326541c 100644 --- a/src/public/index.html +++ b/src/public/index.html @@ -1701,6 +1701,20 @@ }); + // close all tooltips and popups when clicking map + map.on("click", function(event) { + + // do nothing when clicking inside tooltip + const clickedElement = event.originalEvent.target; + if(elementOrAnyAncestorHasClass(clickedElement, "leaflet-tooltip")){ + return; + } + + closeAllTooltips(); + closeAllPopups(); + + }); + function isValidLatLng(lat, lng) { if(isNaN(lat) || isNaN(lng)){ @@ -1955,20 +1969,6 @@ }); - // close all tooltips and popups when clicking map - map.on("click", function(event) { - - // do nothing when clicking inside tooltip - const clickedElement = event.originalEvent.target; - if(elementOrAnyAncestorHasClass(clickedElement, "leaflet-tooltip")){ - return; - } - - closeAllTooltips(); - closeAllPopups(); - - }); - // add to cache nodes.push(node); nodeMarkers[node.node_id] = marker;