]> git.openstreetmap.org Git - rails.git/blobdiff - app/assets/javascripts/leaflet.extend.js.erb
Consolidate search-related JavaScript
[rails.git] / app / assets / javascripts / leaflet.extend.js.erb
index 966d0276b33c6827553dbcaaa9b1366bf4a77584..cec25081b8b463b617c9f11638fa3e7e6ad74150 100644 (file)
@@ -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);
       }