mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-27 00:25:06 +02:00
Merge pull request #358 from Grsmto/spiderified-removelayers
RemoveLayers() when spiderified bug fix
This commit is contained in:
@@ -19,7 +19,7 @@
|
||||
<body>
|
||||
|
||||
<div id="map"></div>
|
||||
<button id="doit">Remove and add direct to map</button><button id="doit2">clearLayers</button><br/>
|
||||
<button id="doit">Remove and add direct to map</button><button id="doit2">clearLayers</button><button id="doit3">removeLayers</button><br/>
|
||||
<span>Bug <a href="https://github.com/danzel/Leaflet.markercluster/issues/54">#54</a>. Spiderfy the cluster then click the button. Should result in 2 markers right beside each other on the map.</span><br/>
|
||||
<span>Bug <a href="https://github.com/danzel/Leaflet.markercluster/issues/53">#53</a>. Spiderfy the cluster then click the button. Spider lines remain on the map.</span><br/>
|
||||
<span>Bug <a href="https://github.com/danzel/Leaflet.markercluster/issues/49">#49</a>. Spiderfy the cluster then click the second button. Spider lines remain on the map. Click the map to get an error.</span>
|
||||
@@ -56,6 +56,9 @@
|
||||
L.DomUtil.get('doit2').onclick = function () {
|
||||
markers.clearLayers();
|
||||
};
|
||||
L.DomUtil.get('doit3').onclick = function () {
|
||||
markers.removeLayers(markersList);
|
||||
};
|
||||
|
||||
</script>
|
||||
</body>
|
||||
|
||||
@@ -57,6 +57,9 @@
|
||||
|
||||
markers[0].__parent.spiderfy();
|
||||
|
||||
// We must wait for the spiderfy animation to timeout
|
||||
clock.tick(200);
|
||||
|
||||
group.removeLayers(markers);
|
||||
|
||||
expect(group.hasLayer(markers[0])).to.be(false);
|
||||
@@ -64,5 +67,9 @@
|
||||
expect(group.hasLayer(markers[2])).to.be(false);
|
||||
|
||||
expect(group.getLayers().length).to.be(0);
|
||||
|
||||
group.on('spiderfied', function() {
|
||||
expect(group._spiderfied).to.be(null);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -251,6 +251,10 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
|
||||
fg = this._featureGroup,
|
||||
npg = this._nonPointGroup;
|
||||
|
||||
if (this._unspiderfy) {
|
||||
this._unspiderfy();
|
||||
}
|
||||
|
||||
if (!this._map) {
|
||||
for (i = 0, l = layersArray.length; i < l; i++) {
|
||||
m = layersArray[i];
|
||||
|
||||
Reference in New Issue
Block a user