Skip to content
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

Update text plane size following text mutation (fixes #2764). #5357

Merged
merged 1 commit into from Oct 19, 2023

Conversation

brycethomas
Copy link
Contributor

The plane width/height was being calculated when the text value was first set, but would not update when the text changed.

Documentation has also been updated to advise using 0 rather than auto for autoscaling behavior. This is based on the the comment here suggesting that auto is not a valid value for geometry (NaN is falsy, so it happened to still work).

The plane width/height was being calculated when the text value was first set,
but would not update when the text changed.

Documentation has also been updated to advise using `0` rather than `auto`
for autoscaling behavior.  This is based on the the comment
[here](aframevr#2837 (comment))
suggesting that `auto` is not a valid value for geometry (NaN is falsy, so it
happened to still work).
@dmarcos
Copy link
Member

dmarcos commented Oct 10, 2023

Thanks for taking the time. Have been a while I touched this code. Your knowledge is more fresh. At first look I would expect the update method to be called when updating the text and this logic to change the plane size to execute:

https://github.com/aframevr/aframe/pull/5357/files#diff-59e71534a2828d71b6a8c63a750a375c722e58636a0717b4afef195333e773d3L305

Why is not working as expected?

@brycethomas
Copy link
Contributor Author

The old code checks whether the geometry width/height is falsy, and if so, sets the geometry width/height. On the next run through update the width/height will no longer be falsy (it was set on the prior update), and so the width/height doesn't get adjusted when the text changes.

@dmarcos
Copy link
Member

dmarcos commented Oct 19, 2023

Thanks for the tests!

@dmarcos dmarcos merged commit d8ade4f into aframevr:master Oct 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants