I ran into a minor bug when trying to automatically center some dynamic text.
First, text objects themselves cannot have their size or position manipulated in realtime, so I had to wrap it in a Clip and manipulate that.
But it turns out, as the text changes, the
Clip.width is only updated if the new text is longer than its original state.
- The text originally says “How now, brown cow?” and the text object is 238.746 px wide. When I run code on the wrapper Clip to get its width, it says 240. (I don’t know why it’s a little off, but that’s not the main bug.)
- When I change the text to something longer, the Clip’s reported width increases.
- But if instead of changing it to something longer, I change it to something shorter, the Clip continues to report that its width is 240.
This makes it impossible to center text properly.
I’m also not sure where
Clip.position is calculated from when code is being used. Is it from the top left? The registration point?
BugReport_Width.wick (98.0 KB)