Skip to content

Commit

Permalink
fix _slice9 == [] (#256)
Browse files Browse the repository at this point in the history
* fix _slice9 == []

[] == [] is false, because arrays
i simply changed `_slice9 == []` to `_slice9.length != 4` which would achieve the intended purpose, i think

* warn if given invalid 9slice array

how can you do this with only 1 conditional again

* Update flixel/addons/ui/FlxUI9SliceSprite.hx

Co-authored-by: George Kurelic <Gkurelic@gmail.com>

---------

Co-authored-by: George Kurelic <Gkurelic@gmail.com>
  • Loading branch information
Nintbros and Geokureli committed Oct 16, 2023
1 parent edb5092 commit dfff192
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion flixel/addons/ui/FlxUI9SliceSprite.hx
Expand Up @@ -158,8 +158,10 @@ class FlxUI9SliceSprite extends FlxUISprite implements IResizable implements IFl
var iw = Std.int(pt.x);
var ih = Std.int(pt.y);

if (_slice9 == null || _slice9 == [])
if (_slice9 == null || _slice9.length != 4)
{
if (_slice9 != null)
flixel.FlxG.log.warn("Invalid 9slice array, expected a length of 4");
_slice9 = [4, 4, 7, 7];
}

Expand Down

0 comments on commit dfff192

Please sign in to comment.