Skip to content

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

Open
@AdamHarte

Description

@AdamHarte

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions