Description
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.
After clicking button to change theme:
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
-
OS: Windows 10
-
Haxe: 4.3.6
-
flixel: 5.8.0
-
haxeui-core: Latest Git (3ab5f92)
-
haxeui-flixel: Latest Git (haxeui/haxeui-flixel@7d9b1af)
-
openfl: 9.4.0
-
lime: 8.2.0
-
Flex: 4.16.1
-
AIR: 51.1.2.1
HaxeUIThemes.zip