-
Notifications
You must be signed in to change notification settings - Fork 390
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
Improve datastore browser column header UI #7344
Conversation
Uses the new `egui::Sides` API. Note that the truncation behavior is not quite perfect yet.
ui.label(match (is_sorted, direction) { | ||
(true, SortDirection::Ascending) => "↓", | ||
(true, SortDirection::Descending) => "↑", | ||
_ => "", | ||
}); |
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 would expect this arrow to be clickable
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.
Interestingly, this brings up a small paper cut with the current Sides
api: I can't mutably borrow anything in both closure, so I'm forced to do something like this:
let mut toggle_left = false;
let mut toggle_right = false;
egui::Sides::new()
.height(re_ui::DesignTokens::table_line_height())
.show(
ui,
|ui| {
ui.style_mut().wrap_mode = Some(egui::TextWrapMode::Truncate);
toggle_left = ui.button(egui::WidgetText::from(label).strong()).clicked();
},
|ui| {
toggle_right = ui
.button(match (is_sorted, direction) {
(true, SortDirection::Ascending) => "↓",
(true, SortDirection::Descending) => "↑",
_ => "",
})
.clicked();
},
);
At a minimum, Sides::show()
should return a tuple of (R1, R2)
generic types corresponding to the return value of each closure.
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.
Co-authored-by: Emil Ernerfeldt <[email protected]>
This addresses this comment: - rerun-io/rerun#7344 (comment) * [x] I have followed the instructions in the PR template
This addresses this comment: - rerun-io/rerun#7344 (comment) * [x] I have followed the instructions in the PR template
What
Uses the new
egui::Sides
API to display the sort arrow. Note that the truncation behaviour is not quite perfect yet.Checklist
main
build: rerun.io/viewernightly
build: rerun.io/viewerCHANGELOG.md
and the migration guideTo run all checks from
main
, comment on the PR with@rerun-bot full-check
.