diff --git a/code/portal_detail_display.js b/code/portal_detail_display.js index 205b80c5..0f02d879 100644 --- a/code/portal_detail_display.js +++ b/code/portal_detail_display.js @@ -95,9 +95,16 @@ window.setPortalIndicators = function(d) { ).addTo(map); else portalAccessIndicator.setLatLng(coord); - } +window.clearPortalIndicators = function() { + if(portalRangeIndicator) map.removeLayer(portalRangeIndicator); + portalRangeIndicator = null; + if(portalAccessIndicator) map.removeLayer(portalAccessIndicator); + portalAccessIndicator = null; +} + + // highlights portal with given GUID. Automatically clears highlights // on old selection. Returns false if the selected portal changed. // Returns true if it’s still the same portal that just needs an @@ -123,4 +130,5 @@ window.unselectOldPortal = function() { if(oldPortal) portalResetColor(oldPortal); selectedPortal = null; $('#portaldetails').html(''); + clearPortalIndicators(); }