fix(hooks/useGamepad): focus state (#110)

This commit is contained in:
/home/neo 2026-07-02 15:52:28 +03:00 committed by GitHub
parent 2e8e6cdec3
commit 121a0bf4cf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -41,6 +41,7 @@ export const useGamepad = ({ playSfx, isWindowVisible }: UseGamepadProps) => {
};
const update = useCallback(() => {
focusedRef.current = document.hasFocus();
if (!focusedRef.current) {
requestRef.current = requestAnimationFrame(update);
return;