Skip to content

Commit

Permalink
Can store keyboard shortcut keys + clear them
Browse files Browse the repository at this point in the history
  • Loading branch information
samclane committed Oct 4, 2024
1 parent f810259 commit 5d89195
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,11 @@ impl MantleApp {
);
ui.separator();
ShortcutEdit::new(&mut self.shortcut_manager.new_shortcut.shortcut).ui(ui);
// Clear button
if ui.button("Clear").clicked() {
self.shortcut_manager.new_shortcut.callback_name.clear();
self.shortcut_manager.new_shortcut.shortcut.keys.clear();
}
ui.separator();
ui.label("TODO: Add callback");
if ui.button("Add").clicked() {
Expand Down
4 changes: 2 additions & 2 deletions src/shortcut.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,10 +246,10 @@ impl<'a> Widget for ShortcutEdit<'a> {
let input_item = from_egui(*key, modifiers);
keys_pressed.extend(input_item);
}
shortcut.keys = keys_pressed;
shortcut.update_display_string();
shortcut.keys.extend(keys_pressed);
});
}
shortcut.update_display_string();

let text = shortcut.display_name.clone();
let text_pos = rect.center();
Expand Down

0 comments on commit 5d89195

Please sign in to comment.