-
Notifications
You must be signed in to change notification settings - Fork 146
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
Support width/height: 'auto'
#27
Comments
I've been investigating how to implement this feature. In my experiments, I game across this library, which uses this library to do most of the layout work. I don't think adding that as a dependency would be the best route though as its lots of bloat. My thoughts are to do the following: Store all geometry bounding boxes (in an in-memory cache) in a tree structure, e.g.
And calculate the children's width/height based on this tree structure each frame. What do you think about this approach? I don't think it will involve a large amount of changes to the existing code to implement. |
Hi @enijar, thanks for investigating this issue. In three-mesh-ui that's the parents that compute the children position because the children dimension is supposed to be known in advance. It's happening here. With the proposed new feature, I suppose the parent would have to decide of the children (with You may have noticed that when a layoutUpdate is triggered it is fired from the highest UI component of a component tree and cascade through the children. So when Is it something similar that you have in mind ? |
@felixmariotto let me pull together a WIP demo of what I'm proposing, and I can share it on a CSB link before making a PR. |
Or you can just file a PR as draft no worries |
Currently, either a Block has a width, either its width can be computed from its children width (same for height).
It would be a great addition to support
width/height: 'auto'
, so that a component takes all the width (or height) it can in its parent component.It should be done by BoxComponent.
The text was updated successfully, but these errors were encountered: