Fix lots of bugs with using CircleMarker/Circle as children. Fixes #189 Fixes #148

This commit is contained in:
danzel
2013-06-14 15:49:01 +12:00
parent 25bb880379
commit 0394227f49
3 changed files with 16 additions and 5 deletions
+3
View File
@@ -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);
});
+9 -3
View File
@@ -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);
}
}
}
}
+4 -2
View File
@@ -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;