fixed instant animation cancel
This commit is contained in:
parent
f3af7d3348
commit
210eca6fa1
1 changed files with 21 additions and 6 deletions
|
|
@ -851,11 +851,7 @@ async function checkToAnimate() {
|
||||||
|
|
||||||
scrolling = true;
|
scrolling = true;
|
||||||
|
|
||||||
await sleep(scrollingSpeed);
|
addAnimationListeners();
|
||||||
|
|
||||||
scrolling = false;
|
|
||||||
renderTaskListToDOM();
|
|
||||||
checkToAnimate();
|
|
||||||
}
|
}
|
||||||
} else if (!scrolling) {
|
} else if (!scrolling) {
|
||||||
document.querySelector(".secondary").style.display = "none";
|
document.querySelector(".secondary").style.display = "none";
|
||||||
|
|
@ -866,9 +862,28 @@ async function checkToAnimate() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function addAnimationListeners() {
|
||||||
|
if (primaryAnimation) {
|
||||||
|
primaryAnimation.addEventListener("finish", animationFinished);
|
||||||
|
primaryAnimation.addEventListener("cancel", animationFinished);
|
||||||
|
}
|
||||||
|
if (secondaryAnimation) {
|
||||||
|
secondaryAnimation.addEventListener("finish", animationFinished);
|
||||||
|
secondaryAnimation.addEventListener("cancel", animationFinished);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function animationFinished() {
|
||||||
|
scrolling = false;
|
||||||
|
renderTaskListToDOM();
|
||||||
|
checkToAnimate();
|
||||||
|
}
|
||||||
|
|
||||||
function cancelAnimation() {
|
function cancelAnimation() {
|
||||||
if (primaryAnimation && secondaryAnimation) {
|
if (primaryAnimation) {
|
||||||
primaryAnimation.cancel();
|
primaryAnimation.cancel();
|
||||||
|
}
|
||||||
|
if (secondaryAnimation) {
|
||||||
secondaryAnimation.cancel();
|
secondaryAnimation.cancel();
|
||||||
}
|
}
|
||||||
scrolling = false;
|
scrolling = false;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue