From 908a77a98e1e701235b71a27d115009653c92020 Mon Sep 17 00:00:00 2001 From: Chris Speciale Date: Wed, 10 Jul 2024 07:50:19 -0400 Subject: [PATCH] Replace old Vector methods MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Taking out the trash. 🎯 --- src/starling/core/Starling.hx | 2 +- src/starling/display/DisplayObjectContainer.hx | 12 ++++++------ src/starling/display/Stage.hx | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/starling/core/Starling.hx b/src/starling/core/Starling.hx index d5037620..b35d216a 100644 --- a/src/starling/core/Starling.hx +++ b/src/starling/core/Starling.hx @@ -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; } diff --git a/src/starling/display/DisplayObjectContainer.hx b/src/starling/display/DisplayObjectContainer.hx index aeb78414..8196ed14 100644 --- a/src/starling/display/DisplayObjectContainer.hx +++ b/src/starling/display/DisplayObjectContainer.hx @@ -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 @@ -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(); } @@ -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) { diff --git a/src/starling/display/Stage.hx b/src/starling/display/Stage.hx index 14f057bd..ea211ea1 100644 --- a/src/starling/display/Stage.hx +++ b/src/starling/display/Stage.hx @@ -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 */