[Pkg-javascript-commits] [leaflet-markercluster] 221/479: Tiny tidy ups

Jonas Smedegaard dr at jones.dk
Thu Oct 16 16:00:33 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 1bda00ac3dfb1fd935144fe8501b81eff95c3687
Author: danzel <danzel at localhost.geek.nz>
Date:   Tue Sep 11 15:33:03 2012 +1200

    Tiny tidy ups
---
 src/MarkerCluster.js      |  6 +++---
 src/MarkerClusterGroup.js | 28 ++++++++++++++--------------
 2 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/src/MarkerCluster.js b/src/MarkerCluster.js
index 622251f..904e455 100644
--- a/src/MarkerCluster.js
+++ b/src/MarkerCluster.js
@@ -76,7 +76,7 @@ L.MarkerCluster = L.Marker.extend({
 		if (new1 instanceof L.MarkerCluster) {
 			if (!isNotificationFromChild) {
 				this._childClusters.push(new1);
-				new1._parent = this;
+				new1.__parent = this;
 			}
 			this._childCount += new1._childCount;
 		} else {
@@ -86,8 +86,8 @@ L.MarkerCluster = L.Marker.extend({
 			this._childCount++;
 		}
 
-		if (this._parent) {
-			this._parent._addChild(new1, true);
+		if (this.__parent) {
+			this.__parent._addChild(new1, true);
 		}
 	},
 
diff --git a/src/MarkerClusterGroup.js b/src/MarkerClusterGroup.js
index 0282d4e..0865ec0 100644
--- a/src/MarkerClusterGroup.js
+++ b/src/MarkerClusterGroup.js
@@ -79,9 +79,9 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
 		//Work out what is visible
 		var visibleLayer = layer,
 			currentZoom = this._map.getZoom();
-		if (layer.__cluster) {
-			while ((visibleLayer.__cluster || visibleLayer._parent)._zoom >= currentZoom) {
-				visibleLayer = (visibleLayer.__cluster || visibleLayer._parent); //TODO Make __cluster the same name as _parent to make this simpler
+		if (layer.__parent) {
+			while (visibleLayer.__parent._zoom >= currentZoom) {
+				visibleLayer = visibleLayer.__parent;
 			}
 		}
 
@@ -133,7 +133,7 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
 		}
 
 		//Work our way up the clusters removing them as we go if required
-		var cluster = marker.__cluster,
+		var cluster = marker.__parent,
 			markers = cluster._markers,
 			otherMarker;
 
@@ -144,7 +144,7 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
 			cluster._childCount--;
 
 			if (cluster._zoom < 0) {
-				//Top level, do nothing?
+				//Top level, do nothing
 				break;
 			} else if (removeFromDistanceGrid && cluster._childCount <= 1) { //Cluster no longer required
 				//We need to push the other marker up to the parent
@@ -155,9 +155,9 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
 				gridUnclustered[cluster._zoom].addObject(otherMarker, map.project(otherMarker.getLatLng(), cluster._zoom));
 
 				//Move otherMarker up to parent
-				this._arraySplice(cluster._parent._childClusters, cluster);
-				cluster._parent._markers.push(otherMarker);
-				otherMarker.__cluster = cluster._parent;
+				this._arraySplice(cluster.__parent._childClusters, cluster);
+				cluster.__parent._markers.push(otherMarker);
+				otherMarker.__parent = cluster.__parent;
 
 				if (cluster._icon) {
 					//Cluster is currently on the map, need to put the marker on the map instead
@@ -169,7 +169,7 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
 				cluster._updateIcon();
 			}
 
-			cluster = cluster._parent;
+			cluster = cluster.__parent;
 		}
 	},
 
@@ -399,24 +399,24 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
 			var closest = gridClusters[zoom].getNearObject(markerPoint);
 			if (closest) {
 				closest._addChild(layer);
-				layer.__cluster = closest;
+				layer.__parent = closest;
 				return;
 			}
 
 			//Try find a marker close by to form a new cluster with
 			closest = gridUnclustered[zoom].getNearObject(markerPoint);
 			if (closest) {
-				if (closest.__cluster) {
+				if (closest.__parent) {
 					this._removeLayer(closest, false);
 				}
-				var parent = closest.__cluster || this._topClusterLevel;
+				var parent = closest.__parent || this._topClusterLevel;
 
 				//Create new cluster with these 2 in it
 
 				var newCluster = new L.MarkerCluster(this, zoom, closest, layer);
 				gridClusters[zoom].addObject(newCluster, this._map.project(newCluster._cLatLng, zoom));
-				closest.__cluster = newCluster;
-				layer.__cluster = newCluster;
+				closest.__parent = newCluster;
+				layer.__parent = newCluster;
 
 				//First create any new intermediate parent clusters that don't exist
 				var lastParent = newCluster;

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