X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/42fa563e01493fd7a6e28d8053f84558e50d5322..dc931c4ac47b340c9a2a8d855fa57a290e838260:/app/assets/javascripts/leaflet.extend.js.erb?ds=inline diff --git a/app/assets/javascripts/leaflet.extend.js.erb b/app/assets/javascripts/leaflet.extend.js.erb index 966d0276b..0ab0fface 100644 --- a/app/assets/javascripts/leaflet.extend.js.erb +++ b/app/assets/javascripts/leaflet.extend.js.erb @@ -140,8 +140,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); }