-
Notifications
You must be signed in to change notification settings - Fork 111
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
Is it possible to get a node layout relative to the root node? #660
Comments
Hi! Taffy doesn't currently provide the layout relative to the root node. You have to calculate this by recursing down the tree from the root. If you need random access then you could do this as a pass over the whole tree and store the result for each node. If you want Taffy to provide this out of the box then we could turn this issue into a feature request for this feature. It would be pretty trivial to add, there's just a memory usage cost every time we store more information on each node. |
I've just finished writing a custom tree impl that does what I want. It's almost identical to I think this would be a useful feature so yeah I'd like to turn this into a feature request. My suggestion would be to provide this as an option, so you either get layouts relative to the parent, or relative to the root, but not both. This should allow you to reuse the layout field if memory usage is a concern. Plus I doubt users would need both kinds of layouts at once anyways. I haven't looked into it yet, but I think rounding and this uhh lets call it "root node adjustment" can be done in the same pass, so that should help reduce perf costs as well. |
Ultimately the absolute coordinates need to be resolved somewhere. I wouldn't expect it to be particularly expensive to do this in Taffy. It would just be done as a post-pass though. So there's also no real need for it to be in Taffy. |
This would be great, honestly. I'd much rather the tree calculate this so my implementation can focus on drawing the widgets on screen. |
Hi I have a question about using this library, in my application I need random access to any node's layout relative to a root node. It seems that the
TaffyTree::layout()
method only gives you the layout relative to the parent node. Is it possible to do a second pass to resolve all layouts relative to a root node or something like that? Will I have to roll my own tree using the low level API to do this?Thanks
The text was updated successfully, but these errors were encountered: