X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/984c6dc1142bbfaf11b1a2749d23f7edf7d1a83b..b756c5fd6ea4a982a654e07f42c8250c7f7d85fc:/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 6b7fac654..966d0276b 100644 --- a/app/assets/javascripts/leaflet.extend.js.erb +++ b/app/assets/javascripts/leaflet.extend.js.erb @@ -155,7 +155,23 @@ L.extend(L.Map.prototype, { } }); -L.Icon.Default.imagePath = <%= "#{assets_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;