[Pkg-javascript-commits] [leaflet-markercluster] 98/479: _clusterOne should use cluster diameter for creating initial clusters rather than radius.

Jonas Smedegaard dr at jones.dk
Thu Oct 16 16:00:15 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 72bf992cb4b9bf359b327d548711d4754de64444
Author: danzel <danzel at localhost.geek.nz>
Date:   Wed Jul 25 09:36:58 2012 +1200

    _clusterOne should use cluster diameter for creating initial clusters rather than radius.
---
 src/MarkerClusterGroup.js | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/MarkerClusterGroup.js b/src/MarkerClusterGroup.js
index 116fff7..aed4383 100644
--- a/src/MarkerClusterGroup.js
+++ b/src/MarkerClusterGroup.js
@@ -131,14 +131,14 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
 	//Will return null or the new MarkerCluster. The clustered in marker is removed from the given array
 	_clusterOne: function (unclusteredMarkers, newMarker, zoom) {
 		var markerPos = newMarker._projCenter || this._map.project(newMarker.getLatLng(), zoom),
-			clusterRadiusSqrd = this.options.maxClusterRadius * this.options.maxClusterRadius,
+			clusterDiameterSqrd = 2 * this.options.maxClusterRadius * 2 * this.options.maxClusterRadius,
 			i, m, mPos;
 
 		for (i = unclusteredMarkers.length - 1; i >= 0; i--) {
 			m = unclusteredMarkers[i];
 			mPos = m._projCenter || this._map.project(m.getLatLng(), zoom);
 
-			if (this._sqDist(markerPos, mPos) <= clusterRadiusSqrd) {
+			if (this._sqDist(markerPos, mPos) <= clusterDiameterSqrd) {
 				//Create a new cluster with these 2
 				var newCluster = new L.MarkerCluster(this, m, newMarker);
 

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