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 support for drag-and-drop in blueprint tree #4910

Merged
merged 36 commits into from
Jan 30, 2024
Merged

Conversation

abey79
Copy link
Member

@abey79 abey79 commented Jan 25, 2024

What

This PR adds support for drag-and-drop in the blueprint tree.

drag_and_drop_4.mp4

It has the following known limitations/future work:

Checklist

  • I have read and agree to Contributor Guide and the Code of Conduct
  • I've included a screenshot or gif (if applicable)
  • I have tested the web demo (if applicable):
  • The PR title and labels are set such as to maximize their usefulness for the next release's CHANGELOG

- `ViewportBlueprint`: added a bunch of tree-walking search functions
- updated blueprint tree ui
- fully isolated drop logic in a no-dependency file

TODO:
- ListItem: dont show icons when a drag is ongoing
- emit Move tree action
- highlight receiving container
- remove arrow for root container
TODO:
- ListItem: dont show icons when a drag is ongoing
- highlight receiving container
- remove arrow for root container
- back port re_::drag_and_drop::* to re_ui_example
TODO:
- highlight receiving container
- remove arrow for root container
- back port re_::drag_and_drop::* to re_ui_example
TODO:
- remove arrow for root container
- back port re_::drag_and_drop::* to re_ui_example
@abey79 abey79 added ui concerns graphical user interface enhancement New feature or request include in changelog labels Jan 25, 2024
TODO:
- drag in one-self is not possible
- remove arrow for root container
- back port re_::drag_and_drop::* to re_ui_example
TODO:
- drag in one-self is not possible
- remove arrow for root container
- back port re_::drag_and_drop::* to re_ui_example
TODO:
- some bugs when self dragging
- remove arrow for root container
- back port re_::drag_and_drop::* to re_ui_example
- check after last items
# Conflicts:
#	crates/re_space_view_text_log/Cargo.toml
@abey79 abey79 marked this pull request as ready for review January 26, 2024 08:29
@nikolausWest
Copy link
Member

The effect of the drop in progress should be live previewed in the viewport.

This one seems like it should be turned into an issue / baked into another issue so we don't drop it

@abey79
Copy link
Member Author

abey79 commented Jan 26, 2024

The effect of the drop in progress should be live previewed in the viewport.

This one seems like it should be turned into an issue / baked into another issue so we don't drop it

Yes, I opened one and forgot to link it. I'm actually using this tracking issue as "ground truth" todo list:

@abey79 abey79 added the do-not-merge Do not merge this PR label Jan 26, 2024
@nikolausWest
Copy link
Member

Excited for this! Such a huge UX win already

@emilk emilk self-requested a review January 29, 2024 10:39
@abey79 abey79 removed the do-not-merge Do not merge this PR label Jan 29, 2024
crates/re_ui/src/drag_and_drop.rs Outdated Show resolved Hide resolved
crates/re_ui/src/drag_and_drop.rs Outdated Show resolved Hide resolved
crates/re_ui/src/drag_and_drop.rs Outdated Show resolved Hide resolved
crates/re_ui/src/list_item.rs Outdated Show resolved Hide resolved
crates/re_ui/src/list_item.rs Outdated Show resolved Hide resolved
crates/re_ui/src/list_item.rs Outdated Show resolved Hide resolved
crates/re_ui/src/list_item.rs Outdated Show resolved Hide resolved
crates/re_ui/src/list_item.rs Outdated Show resolved Hide resolved
crates/re_viewport/src/viewport.rs Outdated Show resolved Hide resolved
crates/re_viewport/src/viewport.rs Outdated Show resolved Hide resolved
@@ -0,0 +1,320 @@
//! Helpers for drag and drop support for reordering hierarchical lists.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really like that this is a completely separate module, with no deps. We could consider moving it to egui; then it could be used for emilk/egui#3903 as well

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's kind of what I had in mind. I would wait a little bit though and see how it crystallise in the short/mid term.

crates/re_viewport/src/viewport.rs Outdated Show resolved Hide resolved
@abey79 abey79 merged commit 1762957 into main Jan 30, 2024
40 checks passed
@abey79 abey79 deleted the antoine/blueprint_dnd branch January 30, 2024 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request include in changelog ui concerns graphical user interface
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Interactive layout items in blueprint tree view
3 participants