feathersui / feathersui-starling

User interface components for Starling Framework and Adobe AIR
https://feathersui.com/learn/as3-starling/
Other
914 stars 386 forks source link

Label component cut off text after context restore #1778

Closed subdan closed 5 years ago

subdan commented 5 years ago

Hello, Josh.

This is a Label with backgroundSkin: screenshot_2

I simulate context restore by calling Starling.current.context.dispose();

When context restore happens Label cut off some text: screenshot_3

I use TextFieldTextRenderer.

Why it happens? Is it a bug? How to fix this issue?

I created a repository with demo project https://github.com/subdan/feathes-label-issue

joshtynjala commented 5 years ago

Thank you! I can reproduce this issue.

It can be reproduced with both TextFieldTextRenderer and TextBlockTextRenderer.

When using Align.TOP and Align.LEFT in the TextFormat, the text is not cut off. It seems to be cut off only when using other alignment values like Align.CENTER, Align.RIGHT, and Align.BOTTOM.

The following simplified code will reproduce the issue on my computer:

var headerLabel:Label = new Label();
headerLabel.textRendererFactory = function():ITextRenderer
{
    return new TextFieldTextRenderer();
};
var fontStyles:TextFormat = new TextFormat("Arial", 20, 0xFFFFFF, Align.CENTER, Align.CENTER);
headerLabel.fontStyles = fontStyles;
headerLabel.text = "Title — Name";
headerLabel.setSize(200, 80);
addChild(headerLabel);

var button:Button = new Button();
button.label = "Click Me";
button.x = 10;
button.y = 100;
button.addEventListener(Event.TRIGGERED, function():void
{
    Starling.current.context.dispose();
})
addChild(button);
subdan commented 5 years ago

When do you plan to fix this issue? Fixing this issue is very important for me.

joshtynjala commented 5 years ago

I plan to fix it before I release the stable build of 4.0. By the end of December for sure, but sooner if find time.

subdan commented 5 years ago

Thank you! It works!