fix(web): freeze timer when auto-complete begins (closes #4)
Build and Deploy / build-and-push (push) Successful in 4m5s
Build and Deploy / build-and-push (push) Successful in 4m5s
The game timer kept counting during the auto-complete animation even though the player had already made their last decision. stopTimer() is now called the moment is_auto_completable fires so elapsed_seconds reflects only real play time, not the animation delay. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -300,6 +300,7 @@ function render(s) {
|
|||||||
board.querySelectorAll(".card.drop-target").forEach(e => e.classList.remove("drop-target"));
|
board.querySelectorAll(".card.drop-target").forEach(e => e.classList.remove("drop-target"));
|
||||||
|
|
||||||
if (s.is_auto_completable && !s.is_won && !acTimer) {
|
if (s.is_auto_completable && !s.is_won && !acTimer) {
|
||||||
|
stopTimer(); // freeze elapsed time at the moment the player's last move completes
|
||||||
acTimer = setInterval(doAutoCompleteStep, 380);
|
acTimer = setInterval(doAutoCompleteStep, 380);
|
||||||
}
|
}
|
||||||
if (s.is_won) {
|
if (s.is_won) {
|
||||||
|
|||||||
Reference in New Issue
Block a user