Clip width is not reported correctly if it contains dynamic text

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)

2 Likes

Here’s a workaround where I got the text to center properly. However, according to this GIF I recorded of it…
874c4668-f36b-421c-8281-c02c521287ad
…it takes a slight delay for the top text to fill in, and a longer delay for it to properly update its width so it can center properly. Is this due to a bug or my code?
BugReport_Width2.wick (98.0 KB)

Hey!

We should be getting text align options in pretty soon, which should help out a lot.

The width not updating is pretty weird, definitely a bug. Will look into this soon!

1 Like