mirror of
https://github.com/photonstorm/phaser
synced 2024-11-24 13:43:26 +00:00
Automatically remove from display list
This commit is contained in:
parent
ae8706a424
commit
7e64b4d624
1 changed files with 12 additions and 0 deletions
|
@ -115,6 +115,16 @@ var Container = new Class({
|
|||
*/
|
||||
this.removeCallback = this.removeHandler;
|
||||
|
||||
/**
|
||||
* A reference to the Scene Display List.
|
||||
*
|
||||
* @name Phaser.GameObjects.Container#_displayList
|
||||
* @type {Phaser.GameObjects.DisplayList}
|
||||
* @private
|
||||
* @since 3.4.0
|
||||
*/
|
||||
this._displayList = scene.sys.displayList;
|
||||
|
||||
this.setPosition(x, y);
|
||||
|
||||
if (Array.isArray(children))
|
||||
|
@ -135,6 +145,8 @@ var Container = new Class({
|
|||
*/
|
||||
addHandler: function (list, gameObject)
|
||||
{
|
||||
this._displayList.remove(gameObject);
|
||||
|
||||
gameObject.on('destroy', this.remove, this);
|
||||
|
||||
if (gameObject.parentContainer)
|
||||
|
|
Loading…
Reference in a new issue