[FIXED] Text Anchor and Positioning Bug?

I recently upgraded to the G2.0 beta and found a pretty annoying issue. Whenever text changes width, the display does not take the new width into account, causing the text to appear out of position. Printing it’s coordinates and anchors show that Corona does not change these values, as they are constant, regardless of the text width.

Attached is a sample project that shows the issue. I originally place the text near the top right corner of the screen and proceed to increase it’s value. As the width changes, the positioning gets messed up.

Can anyone else confirm this? And is it a bug, or something that I’m doing?

Confirmed.

Looks like your code is OK, and should work.

I think it’s best to file an official bug-report since you have a sample project. That way CoronaLabs can track the issue better…

Will do. I just wanted to first make sure that it actually was a bug. :stuck_out_tongue:

Thanks.

The text placement “redraw” bug has been around for a long time and is even in our graphics 1 engine. Text placement doesn’t respect the original “reference point” when the text is redrawn.

This bug has been fixed in build 2006. Unfortunately we also introduced a text rendering bug that causes the text to disappear when updated. We hope to fix this for the next daily build.

Adding a “print( text.contentWidth )” in the text redraw function will force the text to be rendered (for build 2006 only). This will not be needed when this new bug is fixed.

In your test code you set the text anchor points and x/y position in the redraw function. This is no longer needed starting with build 2006.

The issue has been fixed in build 2007 (which no longer requires accessing the text.contentWidth first)

Did the bug come back?

Im running build 2018, and am having similar issues (I can only get texts to get to the right position after a change in content/width if I do a print on the contentWidth).

Confirmed.

Looks like your code is OK, and should work.

I think it’s best to file an official bug-report since you have a sample project. That way CoronaLabs can track the issue better…

Will do. I just wanted to first make sure that it actually was a bug. :stuck_out_tongue:

Thanks.

The text placement “redraw” bug has been around for a long time and is even in our graphics 1 engine. Text placement doesn’t respect the original “reference point” when the text is redrawn.

This bug has been fixed in build 2006. Unfortunately we also introduced a text rendering bug that causes the text to disappear when updated. We hope to fix this for the next daily build.

Adding a “print( text.contentWidth )” in the text redraw function will force the text to be rendered (for build 2006 only). This will not be needed when this new bug is fixed.

In your test code you set the text anchor points and x/y position in the redraw function. This is no longer needed starting with build 2006.

The issue has been fixed in build 2007 (which no longer requires accessing the text.contentWidth first)

Did the bug come back?

Im running build 2018, and am having similar issues (I can only get texts to get to the right position after a change in content/width if I do a print on the contentWidth).