From 9c1c8a6a1edb9a9a77c4525339966823104f0ee0 Mon Sep 17 00:00:00 2001 From: ecco257 <72117210+ecco257@users.noreply.github.com> Date: Fri, 15 Mar 2024 17:01:06 -0400 Subject: [PATCH] Modify playbar to not allow audio control shortcuts based on search active --- src/playbar.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/playbar.rs b/src/playbar.rs index fcab9a7..fa26aab 100644 --- a/src/playbar.rs +++ b/src/playbar.rs @@ -350,7 +350,7 @@ fn QueueToggle(status: RwSignal) -> impl IntoView { pub fn PlayBar(status: RwSignal) -> impl IntoView { // Listen for key down events -- arrow keys don't seem to trigger key press events let _arrow_key_handle = window_event_listener(ev::keydown, move |e: ev::KeyboardEvent| { - if e.key() == "ArrowRight" { + if e.key() == "ArrowRight" && status.with_untracked(|status| status.search_active) == false { e.prevent_default(); log!("Right arrow key pressed, skipping forward by {} seconds", ARROW_KEY_SKIP_TIME); @@ -363,7 +363,7 @@ pub fn PlayBar(status: RwSignal) -> impl IntoView { error!("Unable to skip forward: Unable to get current duration"); } - } else if e.key() == "ArrowLeft" { + } else if e.key() == "ArrowLeft" && status.with_untracked(|status| status.search_active) == false { e.prevent_default(); log!("Left arrow key pressed, skipping backward by {} seconds", ARROW_KEY_SKIP_TIME); @@ -380,7 +380,7 @@ pub fn PlayBar(status: RwSignal) -> impl IntoView { // Listen for space bar presses to play/pause let _space_bar_handle = window_event_listener(ev::keypress, move |e: ev::KeyboardEvent| { - if e.key() == " " { + if e.key() == " " && status.with_untracked(|status| status.search_active) == false { e.prevent_default(); log!("Space bar pressed, toggling play/pause");