From: John Firebaugh Date: Tue, 6 Aug 2013 17:41:15 +0000 (-0700) Subject: Wrap marker coordinates in URLs X-Git-Tag: live~5353 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/e6ef6defb250c6a4720234c7dd91f8a2173662bc Wrap marker coordinates in URLs --- diff --git a/app/assets/javascripts/leaflet.extend.js.erb b/app/assets/javascripts/leaflet.extend.js.erb index a645ed253..8aa9c70ec 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_~", diff --git a/app/assets/javascripts/leaflet.share.js b/app/assets/javascripts/leaflet.share.js index 441acfd74..b53524f25 100644 --- a/app/assets/javascripts/leaflet.share.js +++ b/app/assets/javascripts/leaflet.share.js @@ -296,7 +296,8 @@ L.OSM.share = function (options) { }; if (map.hasLayer(marker)) { - params.marker = marker.getLatLng().lat + ',' + marker.getLatLng().lng; + var latLng = marker.getLatLng().wrap(); + params.marker = latLng.lat + ',' + latLng.lng; } $('#embed_html').val(