diff --git a/app/src/utils/shortcutkeys/handleShortcutKeys.ts b/app/src/utils/shortcutkeys/handleShortcutKeys.ts index bb87970..c3346b8 100644 --- a/app/src/utils/shortcutkeys/handleShortcutKeys.ts +++ b/app/src/utils/shortcutkeys/handleShortcutKeys.ts @@ -42,6 +42,7 @@ const KeyPressListener: React.FC = () => { }; const module = modules[keyCombination]; if (module && !toggleView) { + console.log("hi"); setActiveTool("cursor"); setActiveSubTool("cursor"); if (module === "market") setToggleUI(false, false); @@ -106,6 +107,29 @@ const KeyPressListener: React.FC = () => { }; + const handleSidebarShortcuts = (key: string) => { + if (activeModule !== "market") { + if (key === "Ctrl+\\") { + if (toggleUILeft === toggleUIRight) { + setToggleUI(!toggleUILeft, !toggleUIRight); + } + else { + setToggleUI(true, true); + } + return; + } + if (key === "Ctrl+]") { + setToggleUI(toggleUILeft, !toggleUIRight); + return; + } + if (key === "Ctrl+[") { + setToggleUI(!toggleUILeft, toggleUIRight); + return; + } + } + } + + const handleKeyPress = (event: KeyboardEvent) => { if (isTextInput(document.activeElement)) return; @@ -114,28 +138,8 @@ const KeyPressListener: React.FC = () => { event.preventDefault(); - if (keyCombination === "Ctrl+\\") { - if (toggleUILeft === toggleUIRight) { - setToggleUI(!toggleUILeft, !toggleUIRight); - } - else { - activeModule !== "market" && setToggleUI(true, true); - } - return; - } - if (keyCombination === "Ctrl+]") { - if (activeModule !== "market") { - setToggleUI(toggleUILeft, !toggleUIRight); - } - return; - } - if (keyCombination === "Ctrl+[") { - if (activeModule !== "market") { - setToggleUI(!toggleUILeft, toggleUIRight); - } - return; - } - + // Shortcuts specific for sidebar visibility toggle and others specific to sidebar if added + handleSidebarShortcuts(keyCombination); // Active module selection (builder, simulation, etc.) handleModuleSwitch(keyCombination); // Common editing tools: cursor | delete | free-hand