summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristopher Baines <cb15g11@soton.ac.uk>2014-10-02 21:04:07 +0100
committerChristopher Baines <cb15g11@soton.ac.uk>2014-10-02 21:04:07 +0100
commit087ec3c8b8e1af0b98ff217a1e54abc658880958 (patch)
tree93d86fae986d595626b10cc55b25a8b7447d6b20 /src
parent120cfe1e9ef04942091058eadf49281f41aafecd (diff)
downloadleaflet-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.
Diffstat (limited to 'src')
-rw-r--r--src/leaflet-soton.js10
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();
+ }
});
}