fix(engine): swallow game-mutating hotkeys during pointer drags #185
Reference in New Issue
Block a user
Delete Branch "fix/keyboard-during-drag"
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?
U (undo), N (new game), Z (zen), D/Space (draw) and G (forfeit) were not gated on an active drag: pressing one mid-drag fired a StateChangedEvent whose card re-sync inserted a
CardAnimon the dragged cards, fightingfollow_drag's per-frame Transform writes (jittering XY, animated Z) and leavingDragStateorigin indices stale against the mutated state.handle_keyboard_coreandhandle_keyboard_forfeitnow reuse the mutual-exclusion guardhandle_selection_keysalready documents: skip whileDragStateis non-idle, unless it carries the keyboard-lift sentinel (KEYBOARD_DRAG_TOUCH_ID) — that lift is already dropped cleanly byclear_selection_on_state_change, so blocking it would regress keyboard play. H (hint) is untouched; it never mutates state.Adds five tests: U fires when idle, U swallowed during mouse drag, D swallowed during touch drag, U still allowed during keyboard lift, G swallowed during mouse drag.
Gates:
cargo test --workspaceandcargo clippy --workspace -- -D warningsboth exit 0.🤖 Generated with Claude Code