X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/feeb135760abdbfef0eea193318566d9d96f2523..fa339033e1f00f4f3e2b9c790c5100a863cf91ac:/app/assets/javascripts/leaflet.extend.js.erb?ds=sidebyside diff --git a/app/assets/javascripts/leaflet.extend.js.erb b/app/assets/javascripts/leaflet.extend.js.erb index a645ed253..0df6fd381 100644 --- a/app/assets/javascripts/leaflet.extend.js.erb +++ b/app/assets/javascripts/leaflet.extend.js.erb @@ -33,8 +33,9 @@ L.extend(L.Map.prototype, { params = {}; if (marker && this.hasLayer(marker)) { - params.mlat = marker.getLatLng().lat.toFixed(precision); - params.mlon = marker.getLatLng().lng.toFixed(precision); + var latLng = marker.getLatLng().wrap(); + params.mlat = latLng.lat.toFixed(precision); + params.mlon = latLng.lng.toFixed(precision); } if (this._object) { @@ -53,7 +54,7 @@ L.extend(L.Map.prototype, { getShortUrl: function(marker) { var zoom = this.getZoom(), - latLng = marker && this.hasLayer(marker) ? marker.getLatLng() : this.getCenter(), + latLng = marker && this.hasLayer(marker) ? marker.getLatLng().wrap() : this.getCenter().wrap(), str = window.location.hostname.match(/^www\.openstreetmap\.org/i) ? 'http://osm.org/go/' : 'http://' + window.location.hostname + '/go/', char_array = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_~", @@ -145,6 +146,12 @@ L.extend(L.Map.prototype, { map._objectLayer.addTo(map); } }); + }, + + removeObject: function() { + this._object = null; + if (this._objectLoader) this._objectLoader.abort(); + if (this._objectLayer) this.removeLayer(this._objectLayer); } });