-
-
Notifications
You must be signed in to change notification settings - Fork 35.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HTMLMesh: added textNode wrapping #24781
Conversation
Just noticed that this fix breaks for inline elements (e.g. span), will try to fix this later |
I made a different implementation of it in AdaRoseCannon/aframe-htmlmesh#11 |
@vincentfretin Would you like to do a PR with your implementation? |
Sure, I'll do a PR but probably with a slightly modified version in a few weeks when I'll take the time to do more tests with other languages like Japanese like I commented and double check again the hack about the font size I mentioned there. If you or anyone else have some insights about the comments on the PR AdaRoseCannon/aframe-htmlmesh#11 I'll be glad to read it. |
I remember struggling with implementing this as the textnode width in pixels differs from the parent element width on some displays- this led to some some wrong results when measuring the text width. Using the range instead of the context to compute the wrapping width helped solve this. I couldn't figure out why this was the case at the time. |
When you say context, you mean |
Yes that is what I mean. From memory, I didn't have any significant issues on the headset, but there was a 30% discrepancy (1.3 x the length) on my desktop screen. I might have used a different method though, and your implementation might avoid this. I can't check now but could have a look next week? |
30% that was a lot, me it was 1% but I tested only between Quest browser and Firefox and Chrome on Ubuntu 22.04, also it may be related to the font used. |
Description
If you look at the video on #24779 , the textNode doesn't wrap properly. This PR fixes that.
PS my pico neo isn't able to run the 360 video- I hope that webxr layers will solve that (my headset is a pico neo 3 so haven't been able to test that..)