X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/a1af4d5de13e8a2094089453cbae6478739bd2c8..aa20398cea1c212f27d9004170bdc0aee4d8f854:/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 0df6fd381..cec25081b 100644 --- a/app/assets/javascripts/leaflet.extend.js.erb +++ b/app/assets/javascripts/leaflet.extend.js.erb @@ -122,7 +122,12 @@ L.extend(L.Map.prototype, { styles: { node: options.style, way: options.style, - area: options.style + area: options.style, + changeset: { + weight: 2, + color: '#e90', + fillOpacity: 0 + } } }); @@ -140,8 +145,10 @@ L.extend(L.Map.prototype, { map._objectLayer.addData(xml); - if (options.zoom) map.fitBounds(map._objectLayer.getBounds()); - if (options.callback) options.callback(map._objectLayer.getBounds()); + var bounds = map._objectLayer.getBounds(); + + if (options.zoom && bounds.isValid()) map.fitBounds(bounds); + if (options.callback) options.callback(bounds); map._objectLayer.addTo(map); } @@ -155,7 +162,23 @@ L.extend(L.Map.prototype, { } }); -L.Icon.Default.imagePath = <%= "#{asset_prefix}/images".to_json %>; +L.Icon.Default.imagePath = "/images"; + +L.Icon.Default.imageUrls = { + "/images/marker-icon.png": "<%= asset_path("images/marker-icon.png") %>", + "/images/marker-icon-2x.png": "<%= asset_path("images/marker-icon-2x.png") %>", + "/images/marker-shadow.png": "<%= asset_path("images/marker-shadow.png") %>", + "/images/marker-shadow-2x.png": "<%= asset_path("images/marker-shadow-2x.png") %>" +}; + +L.extend(L.Icon.Default.prototype, { + _oldGetIconUrl: L.Icon.Default.prototype._getIconUrl, + + _getIconUrl: function (name) { + var url = this._oldGetIconUrl(name); + return L.Icon.Default.imageUrls[url]; + } +}); L.Hash.prototype.parseHash = OSM.parseHash; L.Hash.prototype.formatHash = OSM.formatHash;