X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/b28511faca45d8d8abc0d3c2fde5a501bbe94062..bf7b2cf38194380c56fbb419ced588a29c27f7b8:/app/assets/javascripts/leaflet.extend.js.erb diff --git a/app/assets/javascripts/leaflet.extend.js.erb b/app/assets/javascripts/leaflet.extend.js.erb index 91cb12091..a50df013e 100644 --- a/app/assets/javascripts/leaflet.extend.js.erb +++ b/app/assets/javascripts/leaflet.extend.js.erb @@ -29,22 +29,22 @@ L.extend(L.Map.prototype, { }, getUrl: function(marker) { - var center = this.getCenter(), - zoom = this.getZoom(), - precision = zoomPrecision(zoom), - params = { - lat: center.lat.toFixed(precision), - lon: center.lng.toFixed(precision), - zoom: zoom, - layers: this.getLayersCode() - }; + var precision = zoomPrecision(this.getZoom()), + params = {}; if (marker && this.hasLayer(marker)) { params.mlat = marker.getLatLng().lat.toFixed(precision); params.mlon = marker.getLatLng().lng.toFixed(precision); } - return 'http://' + OSM.SERVER_URL + '/?' + querystring.stringify(params); + var url = 'http://' + OSM.SERVER_URL + '/', + query = querystring.stringify(params), + hash = OSM.formatHash(this); + + if (query) url += '?' + query; + if (hash) url += hash; + + return url; }, getShortUrl: function(marker) { @@ -93,3 +93,6 @@ L.extend(L.Map.prototype, { }); L.Icon.Default.imagePath = <%= "#{asset_prefix}/images".to_json %>; + +L.Hash.prototype.parseHash = OSM.parseHash; +L.Hash.prototype.formatHash = OSM.formatHash;