Skip to content

Commit

Permalink
Fix selection history right-click menu not working (#3819)
Browse files Browse the repository at this point in the history
  • Loading branch information
teh-cmc authored Oct 12, 2023
1 parent 541f34d commit 65dc20c
Showing 1 changed file with 12 additions and 0 deletions.
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

0 comments on commit 65dc20c

Please sign in to comment.