lojjic / aframe-troika-text

An A-Frame component for rendering 3D text using troika-three-text
MIT License
71 stars 13 forks source link

How to get height of a-troika-text? #75

Closed Atlinx closed 1 year ago

Atlinx commented 1 year ago

Is it possible to fetch the height of an a-troika-text primitive that's wrapping? I have a background for the text that I'd like to resize to the entire text's current height.

lojjic commented 1 year ago

You can access the underlying Text object via element.troikaTextMesh (not publicly documented, its name could change in the future), from there you should be able to subscribe to synccomplete events and update your background from the info provided in .textRenderInfo.

Atlinx commented 1 year ago

You can access the underlying Text object via element.troikaTextMesh (not publicly documented, its name could change in the future), from there you should be able to subscribe to synccomplete events and update your background from the info provided in .textRenderInfo.

Thanks, that did the trick! :)