1
0

fix key space cool time

This commit is contained in:
2026-03-07 17:35:45 +09:00
parent e16678bd08
commit 1457f2fee2

View File

@@ -49,6 +49,7 @@ export default function App() {
setAnimState({ name, count: countRef.current }); setAnimState({ name, count: countRef.current });
}, []); }, []);
const actionCoolRef = useRef(0);
const doSkillRef = useRef(null); const doSkillRef = useRef(null);
const handleKey = useCallback((e) => { const handleKey = useCallback((e) => {
@@ -58,6 +59,9 @@ export default function App() {
} }
if (e.code === 'Space') { if (e.code === 'Space') {
e.preventDefault(); e.preventDefault();
const now = Date.now();
if (now - actionCoolRef.current < 3000) return;
actionCoolRef.current = now;
const idx = actionIndexRef.current; const idx = actionIndexRef.current;
const anim = ACTION_SEQUENCE[idx % ACTION_SEQUENCE.length]; const anim = ACTION_SEQUENCE[idx % ACTION_SEQUENCE.length];
playAnim(anim); playAnim(anim);