Make clearLayers work when we aren't on the map. Fixes #26

This commit is contained in:
danzel
2012-08-07 10:15:36 +12:00
parent af61861f07
commit 3ef5afc11f
+6
View File
@@ -66,6 +66,12 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
clearLayers: function () {
//Need our own special implementation as the LayerGroup one doesn't work for us
//If we aren't on the map yet, just blow away the markers we know of
if (!this._map) {
this._needsClustering = [];
return this;
}
//Remove all the visible layers
for (var i in this._layers) {
if (this._layers.hasOwnProperty(i)) {