[Pkg-javascript-commits] [leaflet-markercluster] 212/479: Fix up MarkerCluster latlng saving/updating

Jonas Smedegaard dr at jones.dk
Thu Oct 16 16:00:30 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 ed28eedfb13bfef4be05bdbfeae50710c4c4e41c
Author: danzel <danzel at localhost.geek.nz>
Date:   Mon Sep 10 17:17:17 2012 +1200

    Fix up MarkerCluster latlng saving/updating
---
 src/MarkerCluster.js | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/src/MarkerCluster.js b/src/MarkerCluster.js
index f381404..b19a9a7 100644
--- a/src/MarkerCluster.js
+++ b/src/MarkerCluster.js
@@ -48,9 +48,6 @@ L.MarkerCluster = L.Marker.extend({
 
 	//Cludge for Icon
 	createIcon: function () {
-		if (!this._latlng) {
-			this._latlng = this._wLatLng;
-		}
 		return this._group.options.iconCreateFunction(this).createIcon();
 	},
 	createShadow: function () {
@@ -126,9 +123,9 @@ L.MarkerCluster = L.Marker.extend({
 			addedCount = 1;
 		}
 
-		if (!this._latlng) {
+		if (!this._cLatLng) {
 			// when clustering, take position of the first point as the cluster center
-			this._latlng = this._cLatLng = marker._cLatLng || addedLatLng;
+			this._cLatLng = marker._cLatLng || addedLatLng;
 		}
 
 		// when showing clusters, take weighted average of all points as cluster center
@@ -136,7 +133,7 @@ L.MarkerCluster = L.Marker.extend({
 
 		//Calculate weighted latlng for display
 		if (!this._wLatLng) {
-			this._wLatLng = new L.LatLng(addedLatLng.lat, addedLatLng.lng);
+			this._latlng = this._wLatLng = new L.LatLng(addedLatLng.lat, addedLatLng.lng);
 		} else {
 			this._wLatLng.lat = (addedLatLng.lat * addedCount + this._wLatLng.lat * this._childCount) / totalCount;
 			this._wLatLng.lng = (addedLatLng.lng * addedCount + this._wLatLng.lng * this._childCount) / totalCount;

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