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

Add tree widget #229

Draft
wants to merge 25 commits into
base: main
Choose a base branch
from
Draft

Add tree widget #229

wants to merge 25 commits into from

Conversation

hydra
Copy link
Contributor

@hydra hydra commented Dec 6, 2024

First attempt add adding a dynamic tree widget.

Features:

  • nodes are widgets.
  • nodes can be expanded/collapsed.
  • tree can be accessed and manipulated from within the node widgets, e.g. by 'Button::on_click'.

image

TODO

  • Make performant.
  • Use appropriate expand/collapse icons instead of > and v.
  • Only show the expand/collapse icons when there are children.
  • Remove use of the .contain() which is currently there for visualization/debugging purposes.
  • Document.
  • Cleanup code.
  • Squash or cleanup commits.

Issues:

  • the performance is currently abysmal once you add around 4 nested children. adding another child using the 'Add child' makes the UI stall for longer and longer periods for each nested child, scrolling becomes very slow.

Notes:

  • No idea if the approach I took, of using widget composition, was a good idea.
  • Probably some unneeded code, as I tried various approaches that didn't work until I stumbled on one that does.
  • Probably there's some unnecessary cloning going on too, maybe on the whole tree itself including all the nodes. Clone for Tree has been removed.

hydra added 20 commits February 4, 2025 17:31
* the expand/collapse button doesn't work yet.
…ns into the nodes that need to refer to the tree and the node itself.
… callbacks.

* delete buttons only work for the root.
…ct location in the tree. Cleanup the API for `children_keys`.
� Conflicts:
�	examples/tree.rs
…ound in the window when expanding/collapsing nodes.
@hydra
Copy link
Contributor Author

hydra commented Feb 4, 2025

rebased

@ecton ecton marked this pull request as draft March 7, 2025 20:39
@ecton
Copy link
Member

ecton commented Mar 7, 2025

I'm not sure what specific questions there are for me to address on this PR. At this time this control is not something that I personally have a desire for in Cushy so I am not going to be working to finish this myself anytime soon. I will answer questions if you have them.

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.

2 participants