Previously Drawn Card Disappears on Draw #1

Closed
opened 2026-05-05 17:58:08 +00:00 by Quaternions · 1 comment

Visual bug where the last card that was drawn stops rendering when you draw a new card (for the small duration when it should be visible before the new card's tween finishes).

Visual bug where the last card that was drawn stops rendering when you draw a new card (for the small duration when it should be visible before the new card's tween finishes).
Owner

Fix Applied ✓

This response was written by Claude AI (claude-sonnet-4-6) on behalf of funman300.

Root cause: card_positions() rendered exactly visible waste cards — 1 for Draw-One, 3 for Draw-Three. When a draw occurred, render_start was immediately recalculated to exclude the card that was just covered, which got despawned on the same frame the new card's slide-in tween began. This produced a one-frame blank flash before the incoming card finished animating into place.

Fix (commit 33fb962):

  • render_start now uses visible + 1, keeping one extra card in the scene at all times.
  • The extra card sits at x = 0, hidden underneath the visible stack. For Draw-Three, the fan x-offset uses slot.saturating_sub(1) so the 3 visible cards retain their correct fanned positions while the hidden card stays at x = 0.
  • The hidden card disappears naturally once the draw tween slides the new top card into place — no flash.

Existing waste render tests updated to reflect the new bounds (≤ 2 for Draw-One, ≤ 4 for Draw-Three) while still asserting the top card is always present and the fan ordering is correct.

## Fix Applied ✓ > *This response was written by Claude AI (claude-sonnet-4-6) on behalf of funman300.* **Root cause:** `card_positions()` rendered exactly `visible` waste cards — `1` for Draw-One, `3` for Draw-Three. When a draw occurred, `render_start` was immediately recalculated to exclude the card that was just covered, which got despawned on the same frame the new card's slide-in tween began. This produced a one-frame blank flash before the incoming card finished animating into place. **Fix (commit `33fb962`):** - `render_start` now uses `visible + 1`, keeping one extra card in the scene at all times. - The extra card sits at `x = 0`, hidden underneath the visible stack. For Draw-Three, the fan x-offset uses `slot.saturating_sub(1)` so the 3 visible cards retain their correct fanned positions while the hidden card stays at x = 0. - The hidden card disappears naturally once the draw tween slides the new top card into place — no flash. Existing waste render tests updated to reflect the new bounds (`≤ 2` for Draw-One, `≤ 4` for Draw-Three) while still asserting the top card is always present and the fan ordering is correct.
Sign in to join this conversation.
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: funman300/Ferrous-Solitaire#1