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

Label height resizing after theme change, showing one character per line #650

Open
AdamHarte opened this issue Nov 3, 2024 · 1 comment

Comments

@AdamHarte
Copy link

AdamHarte commented Nov 3, 2024

When I change the theme in my app at runtime, some of my labels resize to having one character per line. It is not all labels, and seems to be related to having a space character, or maybe its just when the words wrap.

Default, before theme change:
image

After clicking button to change theme:
image

I have specifically using HaxeUI with Flixel, and targeting Flash (AIR). running with lime test flash

I made a minimal reproduction of the issue, starting from the haxeui flixel template: haxelib run haxeui-core create flixel. Then a custom layout, with a function to change the theme.

It looks like the buttons must have a fixed width for the error to happen.

Potential Fixes

I did find that the Label component in haxeui-core has an override of the calcAutoSize function. The Button calls this from its resizeChildren function when the theme changes. When I add a "+4" to the following line in calcAutoSize, it seems to fix my issue.

size.width += component.getTextDisplay().textWidth;

I know Flash always had issues with this textWidth (and textHeight) properties, and needed a buffer like this when using ActionScript. But I am not sure if this is a good final solution.

My example project: HaxeUIThemes.zip

Environment

@AdamHarte
Copy link
Author

It seems to be an issue since this commit, but that maybe just exposed the issue more: 225c25b

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

1 participant