Choose a destination by tapping, not by hovering #36
No reviewers
Labels
No labels
area/ai
area/build
area/character
area/combat
area/data
area/docs
area/game
area/net
area/ui
area/world
size
l
size
m
size
s
type
bug
type
design
type
feature
type
refactor
type
test
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
icub3d/terra-redux-org!36
Loading…
Reference in a new issue
No description provided.
Delete branch "23-touch-movement-preview"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Implements ADR 0003.
The preview was built on a state a touchscreen does not have.
MovementPreviewheld "theroute to whatever the cursor is over", so on a tablet the tile was never hovered, the
route was never drawn, and the half of the overlay that answers where am I going simply
did not exist.
Two-stage commit
Tap a unit, then tap where it should go. The destination stays chosen with nothing held
down — which is the point: a preview that lives only while a finger is down is one the
player cannot read, because their hand is on top of it.
Choiceis one resource with three states (Idle,Unit,Destination) rather than aselection and a destination side by side. A destination without a unit is not a state this
game has, and two resources would let it be written down.
decideis the whole state machine as a pure function, so every press is testable withoutan
App— the same reasonpathandplanhave no ECS in them. Seven tests cover itdirectly.
Every press either advances the choice or puts it down, and none of them strand the
player:
Input
A
Pointersystem param reads touch first and mouse second, so a device with both behavesas a tablet rather than as a desktop that happens to have a screen. The tile comes from the
press position. The hover cue still follows a mouse, but it only says where the cursor
is — no part of a move is legible through it alone, which is the rule ADR 0003 sets.
Also
unit rather than cancelling. The player has not changed their mind about the unit, only
about where it can get to.
chosen destination. The reticle, not the arrowhead, says the choice is being held — it
survives the finger lifting, where an arrow alone would read as a hover.
Verification
cargo fmt --check,cargo clippy --all-targets -- -D warnings(and with--features perf), andcargo test— 122 passing, up from 114.Driven on a Pixel Tablet by touch: tapping a unit offers its range, tapping a tile draws
the route and holds it across seconds with no input, and tapping the unit again clears it.
Screenshots at each stage; the held frame was captured 6 s after the tap.
Not here
element and belongs with #10. What exists now is tap-to-cancel, which is always in reach
but unlabelled.
leave_mission_on_escape, which is aplaceholder #12 replaces — and
uidoes not depend onworld, so wiring it now wouldinvent a coupling for something about to be rewritten.
Closes #23
🤖 Generated with Claude Code
https://claude.ai/code/session_01TA4hJHkRSU3XBxZYtMKXdh