From 9373af8df20df1e125e72c96ec18b5fc67c73405 Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Wed, 17 Sep 2014 15:06:15 +0100 Subject: Less globals in examples Fix a problem highlighted by this in the vending manchines layer. --- src/leaflet-soton.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src') 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); + } }); } }); -- cgit v1.2.3