]> git.openstreetmap.org Git - rails.git/blobdiff - app/assets/javascripts/leaflet.share.js
Scope map variable.
[rails.git] / app / assets / javascripts / leaflet.share.js
index f085bc0e69ab9e0feefdaf0409e9295d6e995bdd..d43f99b1da1b3032696c4912213593b56c59d712 100644 (file)
@@ -18,6 +18,8 @@ L.Control.Share = L.Control.extend({
 
         this._uiPane = this.options.uiPane;
 
 
         this._uiPane = this.options.uiPane;
 
+        this._map = map;
+
         var h2 = L.DomUtil.create('h2', '', this._uiPane);
         h2.innerHTML = I18n.t('javascripts.share.title');
 
         var h2 = L.DomUtil.create('h2', '', this._uiPane);
         h2.innerHTML = I18n.t('javascripts.share.title');
 
@@ -35,9 +37,9 @@ L.Control.Share = L.Control.extend({
     },
 
     _update: function (e) {
     },
 
     _update: function (e) {
-        var center = map.getCenter().wrap();
-        var layers = getMapLayers();
-        this._linkInput.value = this.options.getUrl(map);
+        var center = this._map.getCenter().wrap();
+        var layers = getMapLayers(this._map);
+        this._linkInput.value = this.options.getUrl(this._map);
     },
 
     _toggle: function() {
     },
 
     _toggle: function() {