Implement getBounds explicitly so it actually works. Thanks @2803media for reporting. Fixes #84

This commit is contained in:
danzel
2012-10-19 09:32:40 +13:00
parent c6b4122967
commit ae3c859e65
+13
View File
@@ -214,6 +214,19 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
return this;
},
//Override FeatureGroup.getBounds as it doesn't work
getBounds: function () {
var bounds = new L.LatLngBounds();
if (this._topClusterLevel) {
bounds.extend(this._topClusterLevel._bounds);
} else {
for (var i = this._needsClustering.length; i >= 0; i--) {
bounds.extend(this._needsClustering[i].getLatLng());
}
}
return bounds;
},
//Returns true if the given layer is in this MarkerClusterGroup
hasLayer: function (layer) {
if (this._needsClustering.length > 0) {