Hello, I am not sure if this is bug - if not, please redirect to proper category. Nevertheless I have noticed that textWidth attribute isn’t updated when trying to access it during onValueChange callback - instead it is providing old text width information. I am attaching simple scene that demonstrates this.
textWidth.1.toe (9.8 KB)
The textWidth attribute uses a cached value which sometimes hasn’t been updated yet when the attribute is evaluated - it’s something we are still looking at improving.
A useful fallback for the textWidth attribute is the ‘evalTextSize’ member of the Text COMP which immediately calculates the string’s width. It’s a little slower, but useful in cases like these where the text layout hasn’t been updated at the point of the callback.
Thank you very much for the tip, ‘evalTextSize’ seems to work as expected.
Also one thing I have noticed (that may or may not help you) is that textWidth never refreshes in case Text COMP has its viewer disabled. This makes sense, but I guess it isn’t ideal when using opviewer (pointing to that Text COMP) - as the TOP itself is updating but textWidth isn’t (not even caching last value).
Nevertheless ‘evalTextSize’ works properly even in this scenario
Thanks for the feedback about the opviewer, I’ll take a look at that. In theory, that should act like the text comp’s viewer just as well as its own.