refactor(transport): make widgets focusable

This commit is contained in:
🪞👃🪞 2024-09-01 20:29:15 +03:00
parent 2106a7c044
commit b8ac83b019
9 changed files with 204 additions and 132 deletions

View file

@ -95,11 +95,25 @@ impl Render for ArrangerStandalone {
impl Handle for ArrangerStandalone {
fn handle (&mut self, e: &AppEvent) -> Usually<bool> {
match e {
AppEvent::Input(Event::Key(KeyEvent { code: KeyCode::Tab, .. })) => {
AppEvent::Input(Event::Key(KeyEvent {
code: KeyCode::Char(' '), ..
})) => {
if let Some(ref mut transport) = self.transport {
transport.toggle_play()?;
Ok(true)
} else {
Ok(false)
}
},
AppEvent::Input(Event::Key(KeyEvent {
code: KeyCode::Tab, ..
})) => {
self.focus_next();
Ok(true)
},
AppEvent::Input(Event::Key(KeyEvent { code: KeyCode::BackTab, .. })) => {
AppEvent::Input(Event::Key(KeyEvent {
code: KeyCode::BackTab, ..
})) => {
self.focus_prev();
Ok(true)
},