From dd110ce020d50c36be970b9bb8ed2aec0e410c54 Mon Sep 17 00:00:00 2001 From: User 1245125 <774754+boombox2000@users.noreply.github.com> Date: Mon, 9 Jun 2025 07:51:53 +0700 Subject: [PATCH] feat : add keyboard hotkey to flip the board (#41) --- .../analysis/panelToolbar/flipBoardButton.tsx | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/sections/analysis/panelToolbar/flipBoardButton.tsx b/src/sections/analysis/panelToolbar/flipBoardButton.tsx index 24a3986..e69c77e 100644 --- a/src/sections/analysis/panelToolbar/flipBoardButton.tsx +++ b/src/sections/analysis/panelToolbar/flipBoardButton.tsx @@ -6,6 +6,20 @@ import { Icon } from "@iconify/react"; export default function FlipBoardButton() { const setBoardOrientation = useSetAtom(boardOrientationAtom); + useEffect(() => { + const onKeyDown = (e: KeyboardEvent) => { + if (e.key === "f") { + setBoardOrientation((prev) => !prev); + } + }; + + window.addEventListener("keydown", onKeyDown); + + return () => { + window.removeEventListener("keydown", onKeyDown); + }; + }, []); + return (