Skip to content

Commit

Permalink
Use removeLayer in layer group empty
Browse files Browse the repository at this point in the history
  • Loading branch information
ivmartel committed Feb 10, 2025
1 parent 84a451d commit 6db5c95
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions src/gui/layerGroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -806,18 +806,14 @@ export class LayerGroup {
* Empty the layer list.
*/
empty() {
for (const layer of this.#layers) {
if (typeof layer !== 'undefined') {
this.removeLayer(layer);
}
}
this.#layers = [];
// reset active indices
this.#activeLayerIndex = undefined;
// remove possible crosshair
this.#removeCrosshairDiv();
// clean container div
const previous = this.#containerDiv.getElementsByClassName('layer');
if (previous) {
while (previous.length > 0) {
previous[0].remove();
}
}
}

/**
Expand Down

0 comments on commit 6db5c95

Please sign in to comment.