Add inline comments across client and server codebase
Full-codebase commenting pass focused on the tricky, fragile, and non-obvious spots: animation coordination flags in app.js, AI decision safety checks in ai.py, scoring evaluation order in game.py, animation engine magic numbers in card-animations.js, and server infrastructure coupling in main.py/handlers.py/room.py. No logic changes. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -31,14 +31,17 @@ class AnimationQueue {
|
||||
};
|
||||
}
|
||||
|
||||
// Add movements to the queue and start processing
|
||||
// Add movements to the queue and start processing.
|
||||
// The onComplete callback only fires after the LAST movement in this batch —
|
||||
// intermediate movements don't trigger it. This is intentional: callers want
|
||||
// to know when the whole sequence is done, not each individual step.
|
||||
async enqueue(movements, onComplete) {
|
||||
if (!movements || movements.length === 0) {
|
||||
if (onComplete) onComplete();
|
||||
return;
|
||||
}
|
||||
|
||||
// Add completion callback to last movement
|
||||
// Attach callback to last movement only
|
||||
const movementsWithCallback = movements.map((m, i) => ({
|
||||
...m,
|
||||
onComplete: i === movements.length - 1 ? onComplete : null
|
||||
@@ -185,7 +188,9 @@ class AnimationQueue {
|
||||
await this.delay(this.timing.flipDuration);
|
||||
}
|
||||
|
||||
// Step 2: Quick crossfade swap
|
||||
// Step 2: Quick crossfade swap.
|
||||
// 150ms is short enough to feel instant but long enough for the eye to
|
||||
// register the transition. Shorter looks like a glitch, longer looks laggy.
|
||||
handCard.classList.add('fade-out');
|
||||
heldCard.classList.add('fade-out');
|
||||
await this.delay(150);
|
||||
|
||||
Reference in New Issue
Block a user