Skip to content

Commit 1467450

Browse files
committed
Utils.Array.MoveUp wouldn't let you move an array element to the top-most index in the array. This also impacted Container.moveUp.
1 parent 52cfd5b commit 1467450

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@
135135
* The Particle Emitter no longer needs to call the StableSort.inplace during its preUpdate, saving cpu.
136136
* `Particle.resetPosition` is a new method that is called when a particle dies, preparing it ready for firing again in the future.
137137
* The Canvas `SetTransform` method would save the context state, but it wasn't restored at the end in the following Game Objects: Dynamic Bitmap Text, Graphics, Arc, Curve, Ellipse, Grid, IsoBox, IsoTriangle, Line, Polygon, Rectangle, Star and Triangle. These now all restore the context, meaning if you're using non-canvas sized cameras in Canvas mode, it will now render beyond just the first custom camera.
138+
* `Utils.Array.MoveUp` wouldn't let you move an array element to the top-most index in the array. This also impacted `Container.moveUp`.
138139

139140
### Examples and TypeScript
140141

src/utils/array/MoveUp.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ var MoveUp = function (array, item)
2020
{
2121
var currentIndex = array.indexOf(item);
2222

23-
if (currentIndex !== -1 && currentIndex < array.length - 2)
23+
if (currentIndex !== -1 && currentIndex < array.length - 1)
2424
{
25+
// The element one above `item` in the array
2526
var item2 = array[currentIndex + 1];
26-
2727
var index2 = array.indexOf(item2);
2828

2929
array[currentIndex] = item2;

0 commit comments

Comments
 (0)