shouldn't attach click listener more than once...
This commit is contained in:
@ -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) {
|
function isValidLatLng(lat, lng) {
|
||||||
|
|
||||||
if(isNaN(lat) || isNaN(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
|
// add to cache
|
||||||
nodes.push(node);
|
nodes.push(node);
|
||||||
nodeMarkers[node.node_id] = marker;
|
nodeMarkers[node.node_id] = marker;
|
||||||
|
Reference in New Issue
Block a user