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);
}
}
});
-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;