From 032d6e80a47baf17fd902c5c1792da0e0a9edba7 Mon Sep 17 00:00:00 2001 From: Vishnu Date: Thu, 15 May 2025 12:10:13 +0530 Subject: [PATCH] refactor: Update KeyPressListener to include isPlaying state for improved shortcut handling --- app/src/utils/shortcutkeys/handleShortcutKeys.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/utils/shortcutkeys/handleShortcutKeys.ts b/app/src/utils/shortcutkeys/handleShortcutKeys.ts index c4d8aa1..db35d84 100644 --- a/app/src/utils/shortcutkeys/handleShortcutKeys.ts +++ b/app/src/utils/shortcutkeys/handleShortcutKeys.ts @@ -21,7 +21,7 @@ const KeyPressListener: React.FC = () => { const { toggleUILeft, toggleUIRight, setToggleUI } = useToggleStore(); const { setToggleThreeD } = useThreeDStore(); const { setToolMode } = useToolMode(); - const { setIsPlaying } = usePlayButtonStore(); + const { isPlaying, setIsPlaying } = usePlayButtonStore(); const { toggleView, setToggleView } = useToggleView(); const { setDeleteTool } = useDeleteTool(); const { setAddAction } = useAddAction(); @@ -67,7 +67,7 @@ const KeyPressListener: React.FC = () => { }; const handleBuilderShortcuts = (key: string) => { - if (activeModule !== "builder") return; + if (activeModule !== "builder" || isPlaying) return; if (key === "TAB") { const toggleTo2D = toggleView; @@ -191,7 +191,7 @@ const KeyPressListener: React.FC = () => { window.addEventListener("keydown", handleKeyPress); return () => window.removeEventListener("keydown", handleKeyPress); // eslint-disable-next-line react-hooks/exhaustive-deps - }, [activeModule, toggleUIRight, toggleUILeft, toggleView, showShortcuts]); + }, [activeModule, toggleUIRight, toggleUILeft, toggleView, showShortcuts, isPlaying]); return null; };