Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
EliteMasterEric opened this issue Sep 28, 2021 · 4 comments

Comments

@EliteMasterEric
Copy link
Contributor

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.

@DigiEggz
Copy link
Contributor

DigiEggz commented Oct 4, 2021

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);

@EliteMasterEric
Copy link
Contributor Author

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.

@DigiEggz
Copy link
Contributor

DigiEggz commented Oct 5, 2021

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.

@EliteMasterEric
Copy link
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants