Skip to content

Commit

Permalink
Renamed methods to avoid Container conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
photonstorm committed Sep 5, 2024
1 parent 4c2f2ed commit b12f3bb
Showing 1 changed file with 32 additions and 60 deletions.
92 changes: 32 additions & 60 deletions src/gameobjects/components/Depth.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,27 +89,20 @@ var Depth = {
},

/**
* Bring this Game Object to the top of the display list, or the top of its parent container.
* Sets this Game Object to be at the top of the display list, or the top of its parent container.
*
* Being at the top means it will render on-top of everything else.
*
* This method does not change this Game Objects `depth` value, it simply alters its list position.
*
* @method Phaser.GameObjects.Components.Depth#bringToTop
* @method Phaser.GameObjects.Components.Depth#setToTop
* @since 3.85.0
*
* @return {this} This Game Object instance.
*/
bringToTop: function ()
setToTop: function ()
{
var list;

if (this.parentContainer)
{
list = this.parentContainer.list;
}
else if (this.displayList)
{
list = this.displayList.list;
}
var list = this.getDisplayList();

if (list)
{
Expand All @@ -120,27 +113,20 @@ var Depth = {
},

/**
* Send this Game Object to the back of the display list, or the back of its parent container.
* Sets this Game Object to the back of the display list, or the back of its parent container.
*
* Being at the back means it will render below everything else.
*
* This method does not change this Game Objects `depth` value, it simply alters its list position.
*
* @method Phaser.GameObjects.Components.Depth#sendToBack
* @method Phaser.GameObjects.Components.Depth#setToBack
* @since 3.85.0
*
* @return {this} This Game Object instance.
*/
sendToBack: function ()
setToBack: function ()
{
var list;

if (this.parentContainer)
{
list = this.parentContainer.list;
}
else if (this.displayList)
{
list = this.displayList.list;
}
var list = this.getDisplayList();

if (list)
{
Expand All @@ -151,70 +137,56 @@ var Depth = {
},

/**
* Move this Game Object so that it appears below the given Game Object.
* Move this Game Object so that it appears above the given Game Object.
*
* This means it will render immediately under the other object in the display list.
* This means it will render immediately after the other object in the display list.
*
* Both objects must belong to the same display list, or parent container.
*
* This method does not change this Game Objects `depth` value, it simply alters its list position.
*
* @method Phaser.GameObjects.Components.Depth#moveBelow
* @method Phaser.GameObjects.Components.Depth#setAbove
* @since 3.85.0
*
* @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that this Game Object will be moved to be below.
* @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that this Game Object will be moved to be above.
*
* @return {this} This Game Object instance.
*/
moveBelow: function (gameObject)
setAbove: function (gameObject)
{
var list;

if (this.parentContainer)
{
list = this.parentContainer.list;
}
else if (this.displayList)
{
list = this.displayList.list;
}
var list = this.getDisplayList();

if (list && gameObject && this !== gameObject)
if (list && gameObject)
{
ArrayUtils.MoveBelow(list, this, gameObject);
ArrayUtils.MoveAbove(list, this, gameObject);
}

return this;
},

/**
* Move this Game Object so that it appears above the given Game Object.
* Move this Game Object so that it appears below the given Game Object.
*
* This means it will render immediately after the other object in the display list.
* This means it will render immediately under the other object in the display list.
*
* Both objects must belong to the same display list, or parent container.
*
* This method does not change this Game Objects `depth` value, it simply alters its list position.
*
* @method Phaser.GameObjects.Components.Depth#moveAbove
* @method Phaser.GameObjects.Components.Depth#setBelow
* @since 3.85.0
*
* @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that this Game Object will be moved to be above.
* @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that this Game Object will be moved to be below.
*
* @return {this} This Game Object instance.
*/
moveAbove: function (gameObject)
setBelow: function (gameObject)
{
var list;

if (this.parentContainer)
{
list = this.parentContainer.list;
}
else if (this.displayList)
{
list = this.displayList.list;
}
var list = this.getDisplayList();

if (list && gameObject && this !== gameObject)
if (list && gameObject)
{
ArrayUtils.MoveAbove(list, this, gameObject);
ArrayUtils.MoveBelow(list, this, gameObject);
}

return this;
Expand Down

0 comments on commit b12f3bb

Please sign in to comment.