summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristopher Baines <cb15g11@soton.ac.uk>2015-03-03 22:30:17 +0000
committerChristopher Baines <cb15g11@soton.ac.uk>2015-03-03 22:30:17 +0000
commit3c67959ced37b920ac95b0a16b45fb49e53a16a3 (patch)
treede6e4c5d5901d7880ff6bca08a74e302df0f8fa0 /src
parent11b86a6d8ab226a55fcd2e69c40989ebc2461853 (diff)
downloadleaflet-soton-3c67959ced37b920ac95b0a16b45fb49e53a16a3.tar
leaflet-soton-3c67959ced37b920ac95b0a16b45fb49e53a16a3.tar.gz
Move the route layer to the bottom
Change the order in which the layers are added to the map, this means that the route layer sits lower down.
Diffstat (limited to 'src')
-rw-r--r--src/leaflet-soton.js21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/leaflet-soton.js b/src/leaflet-soton.js
index 4488f1a..4fe2a2e 100644
--- a/src/leaflet-soton.js
+++ b/src/leaflet-soton.js
@@ -864,7 +864,7 @@ SELECT * WHERE {\
};
}
- layers[layerName] = L.geoJson(emptyFeatureCollection, layerOptions).addTo(map);
+ layers[layerName] = L.geoJson(emptyFeatureCollection, layerOptions);
});
this.on('zoomend', function(e) {
@@ -885,13 +885,11 @@ SELECT * WHERE {\
});
LS.getData(function(data) {
- for (var layerName in layers) {
- var layer = layers[layerName];
-
- layer.clearLayers();
- layer.addData(data[layerName]);
- }
+ // if there is a route layer, deal with it first, as it wants
+ // to be added before the other layers, such that it appears
+ // underneath them (and thus has less priority in user
+ // interactions)
if ("Route" in L) {
var routeLayer = map.routeLayer = new L.Route(options.busRoutes ? data.busRoutes : emptyFeatureCollection, data.busStops, {
routeOptions: {
@@ -939,6 +937,15 @@ SELECT * WHERE {\
}
}
+ for (var layerName in layers) {
+ var layer = layers[layerName];
+
+ layer.clearLayers();
+ layer.addData(data[layerName]);
+
+ layer.addTo(map);
+ }
+
LS.getWorkstationData(function(workstationData) {
if (options.indoor) {