Skip to content

Commit

Permalink
Replace old Vector methods
Browse files Browse the repository at this point in the history
Taking out the trash. 🎯
  • Loading branch information
dimensionscape committed Jul 10, 2024
1 parent 14ade33 commit 908a77a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/starling/core/Starling.hx
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ class Starling extends EventDispatcher
if (__stage != null) __stage.dispose();

var index:Int = sAll.indexOf(this);
if (index != -1) sAll.removeAt(index);
if (index != -1) sAll.splice(index, 1);
if (sCurrent == this) sCurrent = null;
}

Expand Down
12 changes: 6 additions & 6 deletions src/starling/display/DisplayObjectContainer.hx
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ class DisplayObjectContainer extends DisplayObject {
// Re-check the index as it might have changed due to event handlers
index = __children.indexOf(child);
if (index >= 0) {
__children.removeAt(index);
__children.splice(index, 1);
}

// Dispose the child if requested
Expand Down Expand Up @@ -312,7 +312,7 @@ class DisplayObjectContainer extends DisplayObject {
if (oldIndex == -1)
throw new ArgumentError("Not a child of this container");

__children.removeAt(oldIndex);
__children.splice(oldIndex, 1);
__children.insertAt(index, child);
setRequiresRedraw();
}
Expand Down Expand Up @@ -399,10 +399,10 @@ class DisplayObjectContainer extends DisplayObject {
__children[0].getBounds(targetSpace, out);
} else {
// Multiple children: Calculate the combined bounding box
var minX:Float = Float.MAX_VALUE;
var maxX:Float = -Float.MAX_VALUE;
var minY:Float = Float.MAX_VALUE;
var maxY:Float = -Float.MAX_VALUE;
var minX:Float = Max.MAX_VALUE;
var maxX:Float = -Max.MAX_VALUE;
var minY:Float = Max.MAX_VALUE;
var maxY:Float = -Max.MAX_VALUE;

// Iterate over all children to determine the overall bounds
for (i in 0...numChildren) {
Expand Down
2 changes: 1 addition & 1 deletion src/starling/display/Stage.hx
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ class Stage extends DisplayObjectContainer
@:allow(starling) private function removeEnterFrameListener(listener:DisplayObject):Void
{
var index:Int = __enterFrameListeners.indexOf(listener);
if (index >= 0) __enterFrameListeners.removeAt(index);
if (index >= 0) __enterFrameListeners.splice(index, 1);
}

/** @private */
Expand Down

0 comments on commit 908a77a

Please sign in to comment.