[Pkg-javascript-commits] [leaflet-markercluster] 364/479: Fix lots of bugs with using CircleMarker/Circle as children. Fixes #189 Fixes #148

Jonas Smedegaard dr at jones.dk
Thu Oct 16 16:00:51 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 0394227f49192fedd27e99d7d55bfe432afbdb08
Author: danzel <danzel at localhost.geek.nz>
Date:   Fri Jun 14 15:49:01 2013 +1200

    Fix lots of bugs with using CircleMarker/Circle as children. Fixes #189 Fixes #148
---
 spec/suites/CircleMarkerSupportSpec.js |  3 +++
 src/MarkerCluster.js                   | 12 +++++++++---
 src/MarkerClusterGroup.js              |  6 ++++--
 3 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/spec/suites/CircleMarkerSupportSpec.js b/spec/suites/CircleMarkerSupportSpec.js
index 861a122..04b667a 100644
--- a/spec/suites/CircleMarkerSupportSpec.js
+++ b/spec/suites/CircleMarkerSupportSpec.js
@@ -60,6 +60,9 @@
 		expect(marker2._container.parentNode).to.be(map._pathRoot);
 
 		clock.tick(1000);
+
+		expect(marker._container.parentNode).to.be(null);
+		expect(marker2._container.parentNode).to.be(null);
 	});
 
 
diff --git a/src/MarkerCluster.js b/src/MarkerCluster.js
index 073f945..45c4a8f 100644
--- a/src/MarkerCluster.js
+++ b/src/MarkerCluster.js
@@ -210,7 +210,9 @@ L.MarkerCluster = L.Marker.extend({
 						nm._backupLatlng = nm.getLatLng();
 
 						nm.setLatLng(startPos);
-						nm.setOpacity(0);
+						if (nm.setOpacity) {
+							nm.setOpacity(0);
+						}
 					}
 
 					nm._noHas = true;
@@ -263,7 +265,9 @@ L.MarkerCluster = L.Marker.extend({
 					m = c._markers[i];
 					if (!exceptBounds || !exceptBounds.contains(m._latlng)) {
 						L.FeatureGroup.prototype.removeLayer.call(c._group, m);
-						m.setOpacity(1);
+						if (m.setOpacity) {
+							m.setOpacity(1);
+						}
 					}
 				}
 			},
@@ -275,7 +279,9 @@ L.MarkerCluster = L.Marker.extend({
 						if (!L.FeatureGroup.prototype.hasLayer || L.FeatureGroup.prototype.hasLayer.call(c._group, m)) {
 							L.FeatureGroup.prototype.removeLayer.call(c._group, m);
 						}
-						m.setOpacity(1);
+						if (m.setOpacity) {
+							m.setOpacity(1);
+						}
 					}
 				}
 			}
diff --git a/src/MarkerClusterGroup.js b/src/MarkerClusterGroup.js
index a78d07a..6458a01 100644
--- a/src/MarkerClusterGroup.js
+++ b/src/MarkerClusterGroup.js
@@ -113,9 +113,11 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
 		//Remove the marker from clusters
 		this._removeLayer(layer, true);
 
-		if (layer._icon) {
+		if (layer._icon || layer._container) {
 			L.FeatureGroup.prototype.removeLayer.call(this, layer);
-			layer.setOpacity(1);
+			if (layer.setOpacity) {
+				layer.setOpacity(1);
+			}
 		}
 
 		return this;

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