From 1457f2fee2ff36f987a7a1346a35f6ce4f5fdd07 Mon Sep 17 00:00:00 2001 From: syui Date: Sat, 7 Mar 2026 17:35:45 +0900 Subject: [PATCH] fix key space cool time --- src/App.jsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/App.jsx b/src/App.jsx index 9f1d03d..dd5a0b6 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -49,6 +49,7 @@ export default function App() { setAnimState({ name, count: countRef.current }); }, []); + const actionCoolRef = useRef(0); const doSkillRef = useRef(null); const handleKey = useCallback((e) => { @@ -58,6 +59,9 @@ export default function App() { } if (e.code === 'Space') { e.preventDefault(); + const now = Date.now(); + if (now - actionCoolRef.current < 3000) return; + actionCoolRef.current = now; const idx = actionIndexRef.current; const anim = ACTION_SEQUENCE[idx % ACTION_SEQUENCE.length]; playAnim(anim);