flixel-ui icon indicating copy to clipboard operation
flixel-ui copied to clipboard

[BUG] FlxUIButton resets sprite to the default when resize and UpOverDown are used.

Open EliteMasterEric opened this issue 2 years ago • 4 comments

var uiButtonUp = new FlxUIButton(BUTTON_X, BUTTON_Y, null, onClickButton.bind(-1));
uiButtonUp.loadGraphicsUpOverDown(FlxUIAssets.IMG_BUTTON_ARROW_UP);
uiButtonUp.resize(24, 24);

Expected behavior: the UI button should display the provided graphic FlxUIAssets.IMG_BUTTON_ARROW_UP at the specified size.

Actual behavior: the UI button resets its graphic to FlxUIAssets.SLICE9_BUTTON before performing a loadGraphicSlice9 operation to create the button of the desired size.

EliteMasterEric avatar Sep 28 '21 06:09 EliteMasterEric

Should it calling it for static graphics just tell it to set the width and height? Something like this:

if (_slice9_arrays == null)
{
    width = W;
    height = H;
}
else
    loadGraphicSlice9(null, Std.int(W), Std.int(H), null, tile);

DigiEggz avatar Oct 04 '21 13:10 DigiEggz

No, loadGraphicUpOverDown doesn't load a static graphic from what I understand. It loads a graphic which switches when you hover over, or click, the button.

EliteMasterEric avatar Oct 04 '21 18:10 EliteMasterEric

Sorry, I meant that the graphic frames are static rather than pieced together like slice9. When calling resize() on a non-slice9, do you picture it rescaling the graphic to the specified size?

If you can provide any graphic examples of the expected behavior it would be appreciated.

DigiEggz avatar Oct 05 '21 23:10 DigiEggz

Sorry, I meant that the graphic frames are static rather than pieced together like slice9. When calling resize() on a non-slice9, do you picture it rescaling the graphic to the specified size?

If you can provide any graphic examples of the expected behavior it would be appreciated.

I do picture rescaling each piece of the graphic to the specified size.

I can try to create an example later, but basically I'm trying to create an arrow button using the built-in Flixel graphic, but the button is too small as is and I would like to make it larger. Trying to use the scaling function replaces the graphic with a square button which is clearly not intentional.

EliteMasterEric avatar Oct 06 '21 16:10 EliteMasterEric