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

Fix selection history right-click menu not working #3819

Merged
merged 2 commits into from
Oct 12, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions crates/re_viewer/src/ui/selection_history_ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,18 @@ impl SelectionHistoryUi {
item_collection_to_string(blueprint, &previous.selection),
));

let mut return_current = false;
let response = response.context_menu(|ui| {
// undo: newest on top, oldest on bottom
let cur = history.current;
for i in (0..history.current).rev() {
self.history_item_ui(blueprint, ui, i, history);
}
return_current = cur != history.current;
});
if return_current {
return history.current().map(|sel| sel.selection);
}

// TODO(cmc): using the keyboard shortcut should highlight the associated
// button or something (but then again it, it'd make more sense to do that
Expand Down Expand Up @@ -86,12 +92,18 @@ impl SelectionHistoryUi {
item_collection_to_string(blueprint, &next.selection),
));

let mut return_current = false;
let response = response.context_menu(|ui| {
// redo: oldest on top, most recent on bottom
let cur = history.current;
for i in (history.current + 1)..history.stack.len() {
self.history_item_ui(blueprint, ui, i, history);
}
return_current = cur != history.current;
});
if return_current {
return history.current().map(|sel| sel.selection);
}

// TODO(cmc): using the keyboard shortcut should highlight the associated
// button or something (but then again it, it'd make more sense to do that
Expand Down
Loading