diff --git a/packages/graphics/container.js b/packages/graphics/container.js index b944b45..1ca0823 100644 --- a/packages/graphics/container.js +++ b/packages/graphics/container.js @@ -15,10 +15,17 @@ export class Container extends Renderable { this.internal.addChild(child.internal); } - children() { + get children() { return this._children; } + destroy() { + this.children.forEach((child) => { + child.destroy(); + }); + super.destroy(); + } + removeChild(child) { const index = this._children.indexOf(child); if (-1 === index) { diff --git a/packages/graphics/renderable.js b/packages/graphics/renderable.js index 6f5906f..c8e5090 100644 --- a/packages/graphics/renderable.js +++ b/packages/graphics/renderable.js @@ -8,6 +8,10 @@ export class Renderable { this.internal.alpha = alpha; } + destroy() { + this.internal.destroy(); + } + get position() { return [this.internal.x, this.internal.y]; }