[Pkg-javascript-commits] [leaflet-markercluster] 146/479: Make clearLayers work when we aren't on the map. Fixes #26
Jonas Smedegaard
dr at jones.dk
Thu Oct 16 16:00:22 UTC 2014
This is an automated email from the git hooks/post-receive script.
js pushed a commit to branch master
in repository leaflet-markercluster.
commit 3ef5afc11fdb6cd07816448b2c4acc8c357883ce
Author: danzel <danzel at localhost.geek.nz>
Date: Tue Aug 7 10:15:36 2012 +1200
Make clearLayers work when we aren't on the map. Fixes #26
---
src/MarkerClusterGroup.js | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/MarkerClusterGroup.js b/src/MarkerClusterGroup.js
index 417612e..ea4c245 100644
--- a/src/MarkerClusterGroup.js
+++ b/src/MarkerClusterGroup.js
@@ -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)) {
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/leaflet-markercluster.git
More information about the Pkg-javascript-commits
mailing list