projects
/
xogo.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
67c5c19
)
Improve animation when changing tab
author
Benjamin Auder
<benjamin.auder@somewhere>
Sun, 14 Nov 2021 22:27:56 +0000
(23:27 +0100)
committer
Benjamin Auder
<benjamin.auder@somewhere>
Sun, 14 Nov 2021 22:27:56 +0000
(23:27 +0100)
base_rules.js
patch
|
blob
|
blame
|
history
diff --git
a/base_rules.js
b/base_rules.js
index
da72320
..
038126e
100644
(file)
--- a/
base_rules.js
+++ b/
base_rules.js
@@
-2160,20
+2160,21
@@
export default class ChessRules {
};
animateRec(0);
};
};
animateRec(0);
};
- const checkDisplayThenAnimate = () => {
+ // Delay if user wasn't focused:
+ const checkDisplayThenAnimate = (delay) => {
if (boardContainer.style.display == "none") {
alert("New move! Let's go back to game...");
document.getElementById("gameInfos").style.display = "none";
boardContainer.style.display = "block";
setTimeout(launchAnimation, 700);
}
if (boardContainer.style.display == "none") {
alert("New move! Let's go back to game...");
document.getElementById("gameInfos").style.display = "none";
boardContainer.style.display = "block";
setTimeout(launchAnimation, 700);
}
- else
launchAnimation(); //focused user!
+ else
setTimeout(launchAnimation, delay || 0);
};
let boardContainer = document.getElementById("boardContainer");
if (document.hidden) {
document.onvisibilitychange = () => {
document.onvisibilitychange = undefined;
};
let boardContainer = document.getElementById("boardContainer");
if (document.hidden) {
document.onvisibilitychange = () => {
document.onvisibilitychange = undefined;
- checkDisplayThenAnimate();
+ checkDisplayThenAnimate(
700
);
};
}
else checkDisplayThenAnimate();
};
}
else checkDisplayThenAnimate();