Skip to content

Commit 7e64b4d

Browse files
committed
Automatically remove from display list
1 parent ae8706a commit 7e64b4d

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

src/gameobjects/container/Container.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,16 @@ var Container = new Class({
115115
*/
116116
this.removeCallback = this.removeHandler;
117117

118+
/**
119+
* A reference to the Scene Display List.
120+
*
121+
* @name Phaser.GameObjects.Container#_displayList
122+
* @type {Phaser.GameObjects.DisplayList}
123+
* @private
124+
* @since 3.4.0
125+
*/
126+
this._displayList = scene.sys.displayList;
127+
118128
this.setPosition(x, y);
119129

120130
if (Array.isArray(children))
@@ -135,6 +145,8 @@ var Container = new Class({
135145
*/
136146
addHandler: function (list, gameObject)
137147
{
148+
this._displayList.remove(gameObject);
149+
138150
gameObject.on('destroy', this.remove, this);
139151

140152
if (gameObject.parentContainer)

0 commit comments

Comments
 (0)