groups cleanup; fix getBounds when containing CircleMarkers
This commit is contained in:
parent
eeaec502ac
commit
edca4a6075
@ -14,9 +14,7 @@ L.FeatureGroup = L.LayerGroup.extend({
|
||||
return this;
|
||||
}
|
||||
|
||||
if ('on' in layer) {
|
||||
layer.on(L.FeatureGroup.EVENTS, this._propagateEvent, this);
|
||||
}
|
||||
layer.on(L.FeatureGroup.EVENTS, this._propagateEvent, this);
|
||||
|
||||
L.LayerGroup.prototype.addLayer.call(this, layer);
|
||||
|
||||
@ -77,7 +75,7 @@ L.FeatureGroup = L.LayerGroup.extend({
|
||||
var bounds = new L.LatLngBounds();
|
||||
|
||||
this.eachLayer(function (layer) {
|
||||
bounds.extend(layer instanceof L.Marker ? layer.getLatLng() : layer.getBounds());
|
||||
bounds.extend((layer.getBounds || layer.getLatLng)());
|
||||
});
|
||||
|
||||
return bounds;
|
||||
|
@ -42,9 +42,7 @@ L.LayerGroup = L.Layer.extend({
|
||||
},
|
||||
|
||||
hasLayer: function (layer) {
|
||||
if (!layer) { return false; }
|
||||
|
||||
return (layer in this._layers || this.getLayerId(layer) in this._layers);
|
||||
return !layer || layer in this._layers || this.getLayerId(layer) in this._layers;
|
||||
},
|
||||
|
||||
clearLayers: function () {
|
||||
|
@ -161,9 +161,7 @@ L.Map = L.Class.extend({
|
||||
},
|
||||
|
||||
hasLayer: function (layer) {
|
||||
if (!layer) { return false; }
|
||||
|
||||
return (L.stamp(layer) in this._layers);
|
||||
return !layer || L.stamp(layer) in this._layers;
|
||||
},
|
||||
|
||||
eachLayer: function (method, context) {
|
||||
|
Loading…
Reference in New Issue
Block a user