[Pkg-javascript-commits] [leaflet-markercluster] 297/479: Redo eachChildLayer, turns out with a bit of love we can override eachLayer, yay :)

Jonas Smedegaard dr at jones.dk
Thu Oct 16 16:00:44 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 73ae0e9a9b9c858141e09c21533987e4b7901c06
Author: danzel <danzel at localhost.geek.nz>
Date:   Thu Dec 6 13:16:45 2012 +1300

    Redo eachChildLayer, turns out with a bit of love we can override eachLayer, yay :)
    
    Refs #102
---
 README.md                 | 1 -
 src/MarkerClusterGroup.js | 8 ++++----
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/README.md b/README.md
index 3843e38..7caa9e2 100644
--- a/README.md
+++ b/README.md
@@ -107,7 +107,6 @@ If you are removing a lot of markers it will almost definitely be better to call
 
 ### Other Methods
 ````
-eachChildLayer(method, context): Provides an eachLayer implementation. (eachLayer operates on each visible layer, this method runs on all layers added to the MarkerClusterGroup)
 hasLayer(layer): Returns true if the given layer (marker) is in the MarkerClusterGroup
 zoomToShowLayer(layer, callback): Zooms to show the given marker (spidifying if required), calls the callback when the marker is visible on the map
 addLayers(layerArray): Adds the markers in the given array from the MarkerClusterGroup in an efficent bulk method.
diff --git a/src/MarkerClusterGroup.js b/src/MarkerClusterGroup.js
index 262e655..7d2dd19 100644
--- a/src/MarkerClusterGroup.js
+++ b/src/MarkerClusterGroup.js
@@ -230,8 +230,8 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
 		return bounds;
 	},
 
-	//Don't override LayerGroup.eachLayer, but provide the same functionality for external users
-	eachChildLayer: function (method, context) {
+	//Overrides LayerGroup.eachLayer
+	eachLayer: function (method, context) {
 		var markers = this._needsClustering.slice(),
 		    i;
 
@@ -298,7 +298,7 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
 
 	//Overrides FeatureGroup.onAdd
 	onAdd: function (map) {
-		L.FeatureGroup.prototype.onAdd.call(this, map);
+		this._map = map;
 
 		if (!this._gridClusters) {
 			this._generateInitialClusters();
@@ -347,7 +347,7 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
 			this._spiderfierOnRemove();
 		}
 
-		L.FeatureGroup.prototype.onRemove.call(this, map);
+		this._map = null;
 
 		//Clean up all the layers we added to the map
 		for (var i in this._layers) {

-- 
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