[view/map][xs] Small fix in the getBounds method (does not work for multi-geometries)

This commit is contained in:
amercader
2012-04-24 18:53:19 +01:00
parent 3597974469
commit 653eda6f43

View File

@@ -448,9 +448,11 @@ my.Map = Backbone.View.extend({
if (layer instanceof L.Marker){ if (layer instanceof L.Marker){
bounds.extend(layer.getLatLng()); bounds.extend(layer.getLatLng());
} else { } else {
if (layer.getBounds){
bounds.extend(layer.getBounds().getNorthEast()); bounds.extend(layer.getBounds().getNorthEast());
bounds.extend(layer.getBounds().getSouthWest()); bounds.extend(layer.getBounds().getSouthWest());
} }
}
}, this); }, this);
return (typeof bounds.getNorthEast() !== 'undefined') ? bounds : null; return (typeof bounds.getNorthEast() !== 'undefined') ? bounds : null;
} }