mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-28 08:02:41 +02:00
Fix and test for #49, clearLayers wasn't unspiderfying.
This commit is contained in:
@@ -21,9 +21,11 @@
|
||||
<body>
|
||||
|
||||
<div id="map"></div>
|
||||
<button id="doit">Remove and add direct to map</button><br/>
|
||||
<button id="doit">Remove and add direct to map</button><button id="doit2">clearLayers</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>
|
||||
<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>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
var cloudmadeUrl = 'http://{s}.tile.cloudmade.com/BC9A493B41014CAABB98F0471D759707/997/256/{z}/{x}/{y}.png',
|
||||
@@ -52,6 +54,9 @@
|
||||
map.addLayer(markersList[0]);
|
||||
map.addLayer(markersList[1]);
|
||||
};
|
||||
L.DomUtil.get('doit2').onclick = function () {
|
||||
markers.clearLayers();
|
||||
};
|
||||
|
||||
</script>
|
||||
</body>
|
||||
|
||||
@@ -103,6 +103,10 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
|
||||
clearLayers: function () {
|
||||
//Need our own special implementation as the LayerGroup one doesn't work for us
|
||||
|
||||
if (this._unspiderfy) {
|
||||
this._unspiderfy();
|
||||
}
|
||||
|
||||
//If we aren't on the map yet, just blow away the markers we know of
|
||||
if (!this._map) {
|
||||
this._needsClustering = [];
|
||||
|
||||
Reference in New Issue
Block a user