From 56305424ff2ba479917e7c547e8e15179b47ec1c Mon Sep 17 00:00:00 2001 From: adlee-was-taken Date: Sun, 22 Feb 2026 21:09:37 -0500 Subject: [PATCH] Thorough animation cleanup when leaving game - Tag deal container with class so cleanup() can find and remove it - Remove .traveling-card and .deal-anim-container overlays in cleanup() - Restore opacity/visibility on cards hidden mid-animation - Reset all animation flags (dealAnimationInProgress, etc.) in showLobby() Co-Authored-By: Claude Opus 4.6 --- client/app.js | 5 +++++ client/card-animations.js | 13 +++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/client/app.js b/client/app.js index 873b23d..13aa99b 100644 --- a/client/app.js +++ b/client/app.js @@ -3060,6 +3060,11 @@ class GolfGame { if (window.cardAnimations) { window.cardAnimations.cancelAll(); } + this.dealAnimationInProgress = false; + this.isDrawAnimating = false; + this.localDiscardAnimating = false; + this.opponentDiscardAnimating = false; + this.opponentSwapAnimation = false; this.showScreen(this.lobbyScreen); this.lobbyError.textContent = ''; this.roomCode = null; diff --git a/client/card-animations.js b/client/card-animations.js index 902c1a1..e019be5 100644 --- a/client/card-animations.js +++ b/client/card-animations.js @@ -156,12 +156,20 @@ class CardAnimations { } this.activeAnimations.clear(); - // Remove all animation card elements (including those marked as animating) - document.querySelectorAll('.draw-anim-card').forEach(el => { + // Remove all animation overlay elements + document.querySelectorAll('.draw-anim-card, .traveling-card, .deal-anim-container').forEach(el => { delete el.dataset.animating; el.remove(); }); + // Restore visibility on any cards hidden during animations + document.querySelectorAll('.card[style*="opacity: 0"], .card[style*="opacity:0"]').forEach(el => { + el.style.opacity = ''; + }); + document.querySelectorAll('.card[style*="visibility: hidden"], .card[style*="visibility:hidden"]').forEach(el => { + el.style.visibility = ''; + }); + // Restore discard pile visibility if it was hidden during animation const discardPile = document.getElementById('discard'); if (discardPile && discardPile.style.opacity === '0') { @@ -1522,6 +1530,7 @@ class CardAnimations { // Create container for animation cards const container = document.createElement('div'); + container.className = 'deal-anim-container'; container.style.cssText = 'position:fixed;top:0;left:0;right:0;bottom:0;pointer-events:none;z-index:1000;'; document.body.appendChild(container);