Skip to content

Commit e34d759

Browse files
committed
Removed sortGameObjects and getTopGameObject methods
1 parent 4b162fb commit e34d759

2 files changed

Lines changed: 4 additions & 40 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
* MATH_CONST no longer requires or sets the Random Data Generator, this is now done in the Game Config, allowing you to require the math constants without pulling in a whole copy of the RNG with it.
2323
* The Dynamic Bitmap Text Canvas Renderer was creating a new data object every frame for the callback. It now uses the `callbackData` object instead, like the WebGL renderer does.
2424
* `WebGLRenderer.setBlendMode` has a new optional argument `force`, which will force the given blend mode to be set, regardless of the current settings.
25+
* The method `DisplayList.sortGameObjects` has been removed. It has thrown a runtime error since v3.3.0! which no-one even spotted, a good indication of how little the method is used. The display list is automatically sorted anyway, so if you need to sort a small section of it, just use the standard JavaScript Array sort method (thanks ornyth)
26+
* The method `DisplayList.getTopGameObject` has been removed. It has thrown a runtime error since v3.3.0! which no-one even spotted, a good indication of how little the method is used (thanks ornyth)
2527

2628
### Bug Fixes
2729

src/gameobjects/DisplayList.js

Lines changed: 2 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -138,46 +138,8 @@ var DisplayList = new Class({
138138
},
139139

140140
/**
141-
* Given an array of Game Objects, sort the array and return it, so that
142-
* the objects are in index order with the lowest at the bottom.
143-
*
144-
* @method Phaser.GameObjects.DisplayList#sortGameObjects
145-
* @since 3.0.0
146-
*
147-
* @param {Phaser.GameObjects.GameObject[]} gameObjects - The array of Game Objects to sort.
148-
*
149-
* @return {array} The sorted array of Game Objects.
150-
*/
151-
sortGameObjects: function (gameObjects)
152-
{
153-
if (gameObjects === undefined) { gameObjects = this.list; }
154-
155-
this.scene.sys.depthSort();
156-
157-
return gameObjects.sort(this.sortIndexHandler.bind(this));
158-
},
159-
160-
/**
161-
* Get the top-most Game Object in the given array of Game Objects, after sorting it.
162-
*
163-
* Note that the given array is sorted in place, even though it isn't returned directly it will still be updated.
164-
*
165-
* @method Phaser.GameObjects.DisplayList#getTopGameObject
166-
* @since 3.0.0
167-
*
168-
* @param {Phaser.GameObjects.GameObject[]} gameObjects - The array of Game Objects.
169-
*
170-
* @return {Phaser.GameObjects.GameObject} The top-most Game Object in the array of Game Objects.
171-
*/
172-
getTopGameObject: function (gameObjects)
173-
{
174-
this.sortGameObjects(gameObjects);
175-
176-
return gameObjects[gameObjects.length - 1];
177-
},
178-
179-
/**
180-
* All members of the group.
141+
* Returns an array which contains all objects currently on the Display List.
142+
* This is a reference to the main list array, not a copy of it, so be careful not to modify it.
181143
*
182144
* @method Phaser.GameObjects.DisplayList#getChildren
183145
* @since 3.12.0

0 commit comments

Comments
 (0)