Renamed methods to avoid Container conflicts

This commit is contained in:
Richard Davey 2024-09-05 11:29:29 +01:00
parent 4c2f2ed899
commit b12f3bbaa0
No known key found for this signature in database

View file

@ -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)
{
@ -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)
{
@ -150,73 +136,59 @@ var Depth = {
return this;
},
/**
* Move this Game Object so that it appears below the given Game Object.
*
* 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.
*
* @method Phaser.GameObjects.Components.Depth#moveBelow
* @since 3.85.0
*
* @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that this Game Object will be moved to be below.
*
* @return {this} This Game Object instance.
*/
moveBelow: function (gameObject)
{
var list;
if (this.parentContainer)
{
list = this.parentContainer.list;
}
else if (this.displayList)
{
list = this.displayList.list;
}
if (list && gameObject && this !== gameObject)
{
ArrayUtils.MoveBelow(list, this, gameObject);
}
return this;
},
/**
* Move this Game Object so that it appears above the given Game Object.
*
* 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#moveAbove
* @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 above.
*
* @return {this} This Game Object instance.
*/
moveAbove: function (gameObject)
setAbove: function (gameObject)
{
var list;
var list = this.getDisplayList();
if (this.parentContainer)
{
list = this.parentContainer.list;
}
else if (this.displayList)
{
list = this.displayList.list;
}
if (list && gameObject && this !== gameObject)
if (list && gameObject)
{
ArrayUtils.MoveAbove(list, this, gameObject);
}
return this;
},
/**
* Move this Game Object so that it appears below the given Game Object.
*
* 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#setBelow
* @since 3.85.0
*
* @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that this Game Object will be moved to be below.
*
* @return {this} This Game Object instance.
*/
setBelow: function (gameObject)
{
var list = this.getDisplayList();
if (list && gameObject)
{
ArrayUtils.MoveBelow(list, this, gameObject);
}
return this;
}