Rectangle gets corrupted on resize when using adaptWidthToChildren with textblock and padding

I made a UI with a Rectangle and a textblock using resizetofit as well as left and right padding. The Rectangle has adaptWidthToChildren set to true so it will resize whenever the text content changes.

However when the text’s width decreases, there is a weird corruption where it looks like a piece of the old rectangle remains. This only gets fixed when you resize the browser window. Here is a simple playground example. As soon as the text changes from “Hello World” to “Hello” a bit of the rectangle on the right stays rendered even though it resized. I assume this is a bug. Is there anything I can do to get around this right now?


Adding @msDestiny14

Yep. This definitely looks like an issue. Also goes away if you move the rectangle. Looks like something is not getting cleared. I’ll take a look. :slight_smile:

1 Like

Thank you for looking into it. Meanwhile my current workaround to get it cleared looks like this:

topPanel.adaptWidthToChildren = false;
headlineText.text = “hello”;
topPanel.adaptWidthToChildren = true;

Check it out :slight_smile:

1 Like

Excellent, thank you! :slight_smile: