mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-20 09:16:01 +08:00
[ts][pixi-v7][pixi-v8] Add removeSlotObjects to remove all slot objects. Closes #2696.
This commit is contained in:
parent
b443dd1e29
commit
c6ffb37250
@ -402,6 +402,16 @@ export class Spine extends Container {
|
||||
this.slotsObject.delete(slot);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes all PixiJS containers attached to any slot.
|
||||
*/
|
||||
public removeSlotObjects () {
|
||||
for (const [, slotObject] of this.slotsObject) {
|
||||
slotObject.container.removeFromParent();
|
||||
}
|
||||
this.slotsObject.clear();
|
||||
}
|
||||
|
||||
private verticesCache: NumberArrayLike = Utils.newFloatArray(1024);
|
||||
private clippingSlotToPixiMasks: Record<string, Graphics> = {};
|
||||
private pixiMaskCleanup (slot: Slot) {
|
||||
|
||||
@ -775,6 +775,16 @@ export class Spine extends ViewContainer {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes all PixiJS containers attached to any slot.
|
||||
*/
|
||||
public removeSlotObjects () {
|
||||
Object.entries(this._slotsObject).forEach(([slotName, slotObject]) => {
|
||||
if (slotObject) slotObject.container.removeFromParent();
|
||||
delete this._slotsObject[slotName];
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a container attached to a slot, or undefined if no container is attached.
|
||||
*
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user