fix(engine): share Draw-Three waste fan step between renderer and hit-test #106

Merged
funman300 merged 1 commits from fix/draw-three-waste-fan-hittest into master 2026-06-25 17:11:27 +00:00
Owner

Problem

The Draw-Three waste fan x-offset was computed two different ways:

Fan step
Renderer (card_plugin::card_positions) tableau_col_step * 0.224
Hit-test (input_plugin::card_position) card_size.x * 0.28 (hard-coded)

These coincide on desktop/web (col_step = 1.25*cw, and 1.25 * 0.224 = 0.28) but drift on Android: tighter column spacing (H_GAP_DIVISOR=32, col_step ~= 1.03*cw) makes the renderer fan at ~0.231*cw while the hit-test still expects 0.28*cw. The top fanned waste card ends up ~14px left of its click target, so dragging the visible top card grabs the card beneath it.

Fix

Extract waste_fan_step() and tableau_col_step() as the single shared source, called by both the renderer and the hit-test so they can no longer diverge. Adds a regression test (draw_three_waste_hit_test_matches_render_fan_step) that simulates Android-tight spacing and asserts the hit target tracks the renderer.

Desktop/web behaviour is unchanged (the formulas already coincided there). Relevant to the upcoming Android release.

🤖 Generated with Claude Code

## Problem The Draw-Three waste fan x-offset was computed two different ways: | | Fan step | |---|---| | Renderer (`card_plugin::card_positions`) | `tableau_col_step * 0.224` | | Hit-test (`input_plugin::card_position`) | `card_size.x * 0.28` (hard-coded) | These coincide on desktop/web (`col_step = 1.25*cw`, and `1.25 * 0.224 = 0.28`) but **drift on Android**: tighter column spacing (`H_GAP_DIVISOR=32`, `col_step ~= 1.03*cw`) makes the renderer fan at `~0.231*cw` while the hit-test still expects `0.28*cw`. The top fanned waste card ends up ~14px left of its click target, so **dragging the visible top card grabs the card beneath it**. ## Fix Extract `waste_fan_step()` and `tableau_col_step()` as the single shared source, called by both the renderer and the hit-test so they can no longer diverge. Adds a regression test (`draw_three_waste_hit_test_matches_render_fan_step`) that simulates Android-tight spacing and asserts the hit target tracks the renderer. Desktop/web behaviour is unchanged (the formulas already coincided there). Relevant to the upcoming Android release. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
funman300 added 1 commit 2026-06-25 17:11:12 +00:00
The waste fan x-offset was computed two ways: the renderer used
tableau_col_step * 0.224 while the hit-test hard-coded card_size.x * 0.28.
These coincide on desktop (col_step = 1.25*cw) but drift on Android, where
tighter column spacing (H_GAP_DIVISOR=32, col_step ~= 1.03*cw) makes the
renderer fan at ~0.231*cw. The top fanned waste card's sprite then sits
~14px left of its click target, so dragging the visible top card grabs
the card beneath it.

Extract waste_fan_step() and tableau_col_step() as the single source for
both the renderer (card_plugin::card_positions) and the hit-test
(input_plugin::card_position) so they can no longer diverge. Add a
regression test that simulates Android-tight spacing and asserts the hit
target tracks the renderer.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
funman300 merged commit 22334e0dd5 into master 2026-06-25 17:11:27 +00:00
funman300 deleted branch fix/draw-three-waste-fan-hittest 2026-06-25 17:11:27 +00:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: funman300/Ferrous-Solitaire#106