Open arthurmougin opened 3 years ago
How are you attempting to access the bounding box?
I added my component to the a-troika-text primitive. At update, the component store in a value the content of this.el.components["troika-text"]: If that value is not empty, It read the value.troikaTextMesh.geometry.bou'dingBox;
When the initial update happen, every variable when logging .min.x, .min.y.... Return infinity.
I bypassed the issue by testing on tick when they are no longer infinite before recalling update but I don't think it is a great practice.
Edit : I tried adding troika-text to the component depencies but it didnt change the problem
Ah, I see. Text is processed asynchronously, so it's expected that the bounds are initially unknown. See "Handling Asynchronous Updates" here for more info on how to react to the layout completion: https://github.com/protectwise/troika/blob/master/packages/troika-three-text/README.md#handling-asynchronous-updates
Let me know if you have suggestions on how to make this easier to handle in the Aframe wrapper.
I personally think that an event triggered when the text render would be great. For example, when the scene load, there is a "loaded" event
Edit : this would help me and other devs : we could then have a more cleaner implementation on our side then
OK, I'll look into how AFrame does events and see if there's an appropriate common event type I can fire. "loaded"
seems perhaps not quite the right event name since it would fire anytime the text is updated.
Here is the reference if that can help you : https://aframe.io/docs/1.1.0/introduction/javascript-events-dom-apis.html#events-and-event-listeners
Hi, i am trying to access bounding box for a layout script, but i can't read it (value always infinite). i made troika-text the dependency of my component without result. can you help me ?