diff options
author | Christopher Baines <cb15g11@soton.ac.uk> | 2014-10-02 21:04:07 +0100 |
---|---|---|
committer | Christopher Baines <cb15g11@soton.ac.uk> | 2014-10-02 21:04:07 +0100 |
commit | 087ec3c8b8e1af0b98ff217a1e54abc658880958 (patch) | |
tree | 93d86fae986d595626b10cc55b25a8b7447d6b20 | |
parent | 120cfe1e9ef04942091058eadf49281f41aafecd (diff) | |
download | leaflet-soton-087ec3c8b8e1af0b98ff217a1e54abc658880958.tar leaflet-soton-087ec3c8b8e1af0b98ff217a1e54abc658880958.tar.gz |
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.
-rw-r--r-- | src/leaflet-soton.js | 10 |
1 files 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(); + } }); } |