From 087ec3c8b8e1af0b98ff217a1e54abc658880958 Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Thu, 2 Oct 2014 21:04:07 +0100 Subject: Fix issue with workstation layer If the indoor data was showing, the workstation data layer was added to the map. Now it is only added if it is present, which is not the case when indoor data is showing. --- src/leaflet-soton.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/leaflet-soton.js b/src/leaflet-soton.js index 36650e4..830b0ee 100644 --- a/src/leaflet-soton.js +++ b/src/leaflet-soton.js @@ -785,9 +785,13 @@ SELECT * WHERE {\ workstationMarkerLayer = LS.workstationLayer(); LS.on("workstationData", function(data) { - map.removeLayer(workstationMarkerLayer); - workstationMarkerLayer = LS.workstationLayer(); - map.addLayer(workstationMarkerLayer); + if (map.hasLayer(workstationMarkerLayer)) { + map.removeLayer(workstationMarkerLayer); + workstationMarkerLayer = LS.workstationLayer(); + map.addLayer(workstationMarkerLayer); + } else { + workstationMarkerLayer = LS.workstationLayer(); + } }); } -- cgit v1.2.3