From 0f1c22cdc1cec4b5065e465a6bc01cc109849656 Mon Sep 17 00:00:00 2001 From: Jon Atkins Date: Tue, 7 May 2013 04:53:27 +0100 Subject: [PATCH] remove range circles when closing portal details --- code/portal_detail_display.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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(); }