Skip to content

Commit ad5058c

Browse files
committed
Swap on press/release of Space
1 parent 1f584be commit ad5058c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/viewer/viewer_options.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ pub fn viewer_options(ui: &mut Ui, state: &ViewerAppStateRef<'_>) {
1818
}
1919

2020
ui.label("Toggle old/new with SPACE");
21-
if ui.input_mut(|i| i.consume_key(egui::Modifiers::default(), egui::Key::Space)) {
22-
if new_view == View::Old {
21+
ui.input(|i| {
22+
if i.key_pressed(egui::Key::Space) {
2323
new_view = View::New;
24-
} else {
24+
} else if i.key_released(egui::Key::Space) {
2525
new_view = View::Old;
2626
}
27-
}
27+
});
2828

2929
if new_view != state.view {
3030
state.app.send(ViewerSystemCommand::SetView(new_view));

0 commit comments

Comments
 (0)