three-text2d icon indicating copy to clipboard operation
three-text2d copied to clipboard

Hey! Can I ask why you're rounding the result of `measureText` up to the nearest power of two?

Open MeoMix opened this issue 9 years ago • 0 comments

Hey there,

Using the library a lot for a project. Really appreciate the effort you've put into it. Thanks.

I ran into a weird bug with my program and it took some hunting to figure out what happened. I wasn't seeing a click event propagate to a mesh in my scene. It turns out this is happening because the Text2D material (which is transparent) has a width which can be much wider than the text it's displaying. This is because after measuring the text -- it's rounded up to the next power of 2.

If I remove the logic which rounds up... everything still seems to work fine, albeit I get a warning from the ThreeJS renderer.

Would you consider adding a configuration setting which allows for opting out of the rounded dimensions? I can appreciate this might be a performance concern, but I'm not sure to what extent it is.

MeoMix avatar Jan 21 '17 00:01 MeoMix