summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristopher Baines <cb15g11@soton.ac.uk>2014-09-17 15:06:15 +0100
committerChristopher Baines <cb15g11@soton.ac.uk>2014-09-17 15:06:15 +0100
commit9373af8df20df1e125e72c96ec18b5fc67c73405 (patch)
tree84f26cc1e604bc08adec80a8e14a0549536c59ce /src
parent541329d02b32c0ce547d62e5b7b7f42ea9fd2a40 (diff)
downloadleaflet-soton-9373af8df20df1e125e72c96ec18b5fc67c73405.tar
leaflet-soton-9373af8df20df1e125e72c96ec18b5fc67c73405.tar.gz
Less globals in examples
Fix a problem highlighted by this in the vending manchines layer.
Diffstat (limited to 'src')
-rw-r--r--src/leaflet-soton.js15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/leaflet-soton.js b/src/leaflet-soton.js
index b8f1414..cb8184b 100644
--- a/src/leaflet-soton.js
+++ b/src/leaflet-soton.js
@@ -119,14 +119,17 @@
pointToLayer: vendingPointToLayer,
onEachFeature: function(feature, layer) {
layer.on('click', function(e) {
- var popupOptions = {
- offset: icons.vendingHotDrinks.options.popupAnchor
- };
- var content = vendingPopupTemplate(feature.properties);
+ // If this is a leaflet-soton map
+ if ("showInfo" in this._map) {
+ var popupOptions = {
+ offset: icons.vendingHotDrinks.options.popupAnchor
+ };
- // TODO: Unsure if map is accessible?
- map.showInfo(content, e.latlng, popupOptions);
+ var content = vendingPopupTemplate(feature.properties);
+
+ this._map.showInfo(content, e.latlng, popupOptions);
+ }
});
}
});