-
Notifications
You must be signed in to change notification settings - Fork 366
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
Use ListItem
in blueprint tree UI
#3118
Conversation
I can reproduce on all 3 major browsers but not on native 🤔 Edit: nvm I can reproduce on native as well with a "slow" example (e.g. opf) Edit2: |
Instead, support for hover overriding is built in ListItem. This reduces the frame lag and related flicker.
…ordings (looks better)
# Conflicts: # crates/re_viewport/src/viewport_blueprint_ui.rs
let response = ListItem::new(ctx.re_ui, space_view.display_name.clone()) | ||
.selected(ctx.selection().contains(&item)) | ||
.subdued(!visible) | ||
.override_hover(is_item_hovered) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we can come up with a more elegant solution to this. It's not obvious how though.
The best I can come up with is this: produce the Id
of the list item first, then call egui::Context::highlight_widget
(if needed) before calling ListItem::new(…).id(id)
.
let list_item_id = ui.id().with(space_view.id);
if is_item_hovered {
ui.ctx().highlight_widget(list_item_id);
}
let response = ListItem::new(ctx.re_ui, space_view.display_name.clone())
.id(list_item_id)
…
(…though this also requires a fix to egui to make highlight_widget
take effect the same frame).
Alternative fix: add something to egui along the lines of ui.highlight_next_item()
, but I don't really like that sort of statefullness (and it might accidentally affect only part of the next widget, e.g. the triangle).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like this much either, but I'm in favour of punting on that.
My rationale is that piggy-backing on the hover state to show relations between disjoints UI elements related to the same "thing" is just wrong in the first place. With the new ListItem
, it's visually too intrusive for my taste (I have that noted in #3120):
In the long run, we will instead need a new kind of dedicated highlighting, which will require adapting the Selection Panel UI as well. This new state will be unknown to egui, so it's probably not the right place to hack now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense - though we could also make highlight
something separate in egui from hovered
. But I agree on the punt part
What
This PR back-ports
ListItem
into the blueprint tree UI. This includes multiple fixes and additions toListItem
itself.Note that this PR strictly replicates the current behaviour, which has several issues:
Fixes:
ListItem
in Blueprint tree UI #3044Checklist