[Pkg-javascript-commits] [leaflet-markercluster] 07/128: Revert "Cludge around setLatLng so we don't cause 'move' events when we hack-move markers. This wants doing better."

Jonas Smedegaard dr at jones.dk
Sun Apr 16 06:25:58 UTC 2017


This is an automated email from the git hooks/post-receive script.

js pushed a commit to branch master
in repository leaflet-markercluster.

commit f86404e8415419898e777fb9f217065962a3d242
Author: danzel <danzel at localhost.geek.nz>
Date:   Thu Jan 30 13:32:19 2014 +1300

    Revert "Cludge around setLatLng so we don't cause 'move' events when we hack-move markers. This wants doing better."
    
    This reverts commit 51014578d75099191f4a9c9014cf07b4476debea.
---
 src/MarkerCluster.js      | 20 ++++----------------
 src/MarkerClusterGroup.js |  5 +----
 2 files changed, 5 insertions(+), 20 deletions(-)

diff --git a/src/MarkerCluster.js b/src/MarkerCluster.js
index 12559ab..a3a7d67 100644
--- a/src/MarkerCluster.js
+++ b/src/MarkerCluster.js
@@ -153,10 +153,7 @@ L.MarkerCluster = L.Marker.extend({
 	_addToMap: function (startPos) {
 		if (startPos) {
 			this._backupLatlng = this._latlng;
-
-			//We don't use setLatLng so we don't cause a 'move' event
-			this._latlng = startPos;
-			this.update();
+			this.setLatLng(startPos);
 		}
 		this._group._featureGroup.addLayer(this);
 	},
@@ -233,10 +230,7 @@ L.MarkerCluster = L.Marker.extend({
 					if (startPos) {
 						nm._backupLatlng = nm.getLatLng();
 
-						//We don't use setLatLng so we don't cause a 'move' event
-						nm._latlng = startPos;
-						nm.update();
-
+						nm.setLatLng(startPos);
 						if (nm.setOpacity) {
 							nm.setOpacity(0);
 						}
@@ -256,10 +250,7 @@ L.MarkerCluster = L.Marker.extend({
 		for (var i = this._markers.length - 1; i >= 0; i--) {
 			var nm = this._markers[i];
 			if (nm._backupLatlng) {
-				//We don't use setLatLng so we don't cause a 'move' event
-				nm._latlng = nm._backupLatlng;
-				nm.update();
-
+				nm.setLatLng(nm._backupLatlng);
 				delete nm._backupLatlng;
 			}
 		}
@@ -278,10 +269,7 @@ L.MarkerCluster = L.Marker.extend({
 
 	_restorePosition: function () {
 		if (this._backupLatlng) {
-			//We don't use setLatLng so we don't cause a 'move' event
-			this._latlng = this._backupLatlng;
-			this.update();
-
+			this.setLatLng(this._backupLatlng);
 			delete this._backupLatlng;
 		}
 	},
diff --git a/src/MarkerClusterGroup.js b/src/MarkerClusterGroup.js
index 90f63f0..abd3271 100644
--- a/src/MarkerClusterGroup.js
+++ b/src/MarkerClusterGroup.js
@@ -1039,10 +1039,7 @@ L.MarkerClusterGroup.include(!L.DomUtil.TRANSITION ? {
 			if (cluster._childCount === 1) {
 				var m = cluster._markers[0];
 				//If we were in a cluster animation at the time then the opacity and position of our child could be wrong now, so fix it
-				//We don't use setLatLng so we don't cause a 'move' event
-				m._latlng = m.getLatLng();
-				m.update();
-
+				m.setLatLng(m.getLatLng());
 				if (m.setOpacity) {
 					m.setOpacity(1);
 				}

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