mirror of
https://github.com/photonstorm/phaser
synced 2024-11-28 07:31:11 +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;
|
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);
|
this.setPosition(x, y);
|
||||||
|
|
||||||
if (Array.isArray(children))
|
if (Array.isArray(children))
|
||||||
|
@ -135,6 +145,8 @@ var Container = new Class({
|
||||||
*/
|
*/
|
||||||
addHandler: function (list, gameObject)
|
addHandler: function (list, gameObject)
|
||||||
{
|
{
|
||||||
|
this._displayList.remove(gameObject);
|
||||||
|
|
||||||
gameObject.on('destroy', this.remove, this);
|
gameObject.on('destroy', this.remove, this);
|
||||||
|
|
||||||
if (gameObject.parentContainer)
|
if (gameObject.parentContainer)
|
||||||
|
|
Loading…
Reference in a new issue