Skip to content

Commit 5e4e0f3

Browse files
committed
add a few keyboard shortcuts
1 parent 6017512 commit 5e4e0f3

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

crates/notation_bevy/src/app/app.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,10 @@ fn handle_keyboard_inputs(
212212
crate::viewer::control::ControlView::play_or_stop(&mut midi_state, &mut play_control_evts);
213213
} else if keyboard_input.just_released(KeyCode::Backslash) {
214214
crate::viewer::control::ControlView::toggle_layout_mode(&mut app_state, &mut settings, &mut theme);
215+
} else if keyboard_input.just_released(KeyCode::M) {
216+
crate::viewer::control::ControlView::toggle_show_melody_syllable(&mut app_state, &mut settings, &mut theme);
217+
} else if keyboard_input.just_released(KeyCode::F) {
218+
crate::viewer::control::ControlView::toggle_always_show_fret(&mut app_state, &mut settings, &mut theme);
215219
}
216220
}
217221

crates/notation_bevy/src/viewer/control.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,22 @@ impl ControlView {
224224
}
225225
Self::reload_tab(state, theme);
226226
}
227+
pub fn toggle_show_melody_syllable(
228+
state: &mut NotationAppState,
229+
settings: &mut NotationSettings,
230+
theme: &mut NotationTheme,
231+
) {
232+
settings.show_melody_syllable = !settings.show_melody_syllable;
233+
Self::reload_tab(state, theme);
234+
}
235+
pub fn toggle_always_show_fret(
236+
state: &mut NotationAppState,
237+
settings: &mut NotationSettings,
238+
theme: &mut NotationTheme,
239+
) {
240+
settings.always_show_fret = !settings.always_show_fret;
241+
Self::reload_tab(state, theme);
242+
}
227243
pub fn overrides_ui(
228244
ui: &mut Ui,
229245
settings: &mut NotationSettings,

0 commit comments

Comments
 (0)