[Pkg-javascript-commits] [leaflet-markercluster] 292/479: Add options.spiderfyDistanceMultiplier, allows making spiderfied markers go futher away. Fixes #100

Jonas Smedegaard dr at jones.dk
Thu Oct 16 16:00:40 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 bb92b17b2056f51d8c1ebcfde56233923cbd72c9
Author: danzel <danzel at localhost.geek.nz>
Date:   Wed Dec 5 11:28:54 2012 +1300

    Add options.spiderfyDistanceMultiplier, allows making spiderfied markers go futher away. Fixes #100
---
 src/MarkerCluster.Spiderfier.js | 10 ++++++----
 src/MarkerClusterGroup.js       |  3 +++
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/MarkerCluster.Spiderfier.js b/src/MarkerCluster.Spiderfier.js
index 90d0c5e..c66723a 100644
--- a/src/MarkerCluster.Spiderfier.js
+++ b/src/MarkerCluster.Spiderfier.js
@@ -51,7 +51,7 @@ L.MarkerCluster.include({
 	},
 
 	_generatePointsCircle: function (count, centerPt) {
-		var circumference = this._circleFootSeparation * (2 + count),
+		var circumference = this._group.options.spiderfyDistanceMultiplier * this._circleFootSeparation * (2 + count),
 			legLength = circumference / this._2PI,  //radius from circumference
 			angleStep = this._2PI / count,
 			res = [],
@@ -68,7 +68,9 @@ L.MarkerCluster.include({
 	},
 
 	_generatePointsSpiral: function (count, centerPt) {
-		var legLength = this._spiralLengthStart,
+		var legLength = this._group.options.spiderfyDistanceMultiplier * this._spiralLengthStart,
+			separation = this._group.options.spiderfyDistanceMultiplier * this._spiralFootSeparation,
+			lengthFactor = this._group.options.spiderfyDistanceMultiplier * this._spiralLengthFactor,
 			angle = 0,
 			res = [],
 			i;
@@ -76,9 +78,9 @@ L.MarkerCluster.include({
 		res.length = count;
 
 		for (i = count - 1; i >= 0; i--) {
-			angle += this._spiralFootSeparation / legLength + i * 0.0005;
+			angle += separation / legLength + i * 0.0005;
 			res[i] = new L.Point(centerPt.x + legLength * Math.cos(angle), centerPt.y + legLength * Math.sin(angle))._round();
-			legLength += this._2PI * this._spiralLengthFactor / angle;
+			legLength += this._2PI * lengthFactor / angle;
 		}
 		return res;
 	}
diff --git a/src/MarkerClusterGroup.js b/src/MarkerClusterGroup.js
index 7e24d8b..d5c7f29 100644
--- a/src/MarkerClusterGroup.js
+++ b/src/MarkerClusterGroup.js
@@ -20,6 +20,9 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
 		// If you are adding individual markers set to true, if adding bulk markers leave false for massive performance gains.
 		animateAddingMarkers: false,
 
+		//Increase to increase the distance away that spiderfied markers appear from the center
+		spiderfyDistanceMultiplier: 1,
+
 		//Options to pass to the L.Polygon constructor
 		polygonOptions: {}
 	},

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