summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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) {