feat: destroy renderables
This commit is contained in:
parent
72459bc0a9
commit
a02353f95a
|
@ -15,10 +15,17 @@ export class Container extends Renderable {
|
||||||
this.internal.addChild(child.internal);
|
this.internal.addChild(child.internal);
|
||||||
}
|
}
|
||||||
|
|
||||||
children() {
|
get children() {
|
||||||
return this._children;
|
return this._children;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
destroy() {
|
||||||
|
this.children.forEach((child) => {
|
||||||
|
child.destroy();
|
||||||
|
});
|
||||||
|
super.destroy();
|
||||||
|
}
|
||||||
|
|
||||||
removeChild(child) {
|
removeChild(child) {
|
||||||
const index = this._children.indexOf(child);
|
const index = this._children.indexOf(child);
|
||||||
if (-1 === index) {
|
if (-1 === index) {
|
||||||
|
|
|
@ -8,6 +8,10 @@ export class Renderable {
|
||||||
this.internal.alpha = alpha;
|
this.internal.alpha = alpha;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
destroy() {
|
||||||
|
this.internal.destroy();
|
||||||
|
}
|
||||||
|
|
||||||
get position() {
|
get position() {
|
||||||
return [this.internal.x, this.internal.y];
|
return [this.internal.x, this.internal.y];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user