Mobile touch: system edges, per-finger cancel, long-press sort
Interaction ideas from jhaizhou-ops/d2r-mobile (MIT), no code taken: - world fingers in the bottom safe inset (gesture bar) are ignored - SDL_EVENT_FINGER_CANCELED cancels one finger; a cancelled joystick keeps its vector for 300 ms and a finger near the old base re-acquires it - attack taps shorter than a frame release on the next Update - cancelled UI touches and world taps park the pointer (no hover residue) - long press on an empty inventory cell offers the original sort Desktop ctest 59/59; sort sheet verified on the device. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
c132891aef
commit
ae713a0772
+37
-1
@@ -1588,4 +1588,40 @@ Verified on the device: minimap inside its frame, portrait/status bars and the e
|
||||
at the top edge. Desktop ctest 59/59.
|
||||
|
||||
Outstanding: after a tap the cursor stays where the finger lifted, so hover tooltips
|
||||
(e.g. "[F6] Battle pass") remain until the next touch.
|
||||
(e.g. "[F6] Battle pass") remain until the next touch. (Addressed below: world taps and
|
||||
cancelled touches now park the pointer too.)
|
||||
|
||||
### 2026-10-13 Mobile touch: system edges, cancel, long-press sort
|
||||
|
||||
Interaction ideas from jhaizhou-ops/d2r-mobile (MIT); only the ideas were taken, no code.
|
||||
docs/MOBILE-ARCHITECTURE.md has the details ("系统边缘与取消").
|
||||
|
||||
- `TouchRouter`:
|
||||
- world fingers that land in the bottom safe inset (the gesture bar) are `Owner::Ignored`;
|
||||
- new `FingerCancel(id, ms)`: `SDL_EVENT_FINGER_CANCELED` now cancels only that finger
|
||||
instead of `CancelAll`;
|
||||
- a cancelled joystick finger keeps the stick vector for `joy_reacquire_ms` (300). A finger
|
||||
landing within 1.5 radii of the old base takes it over, keeping the same base;
|
||||
- an attack tap shorter than a frame releases on the next `Update`;
|
||||
- new sink hook `UiPointerIdle`: a cancelled pending UI touch parks the pointer.
|
||||
- Host: a world tap's deferred button-up also parks the pointer (`TouchUiPointerIdle`), so no
|
||||
hover tooltip or target stays under the tap point.
|
||||
- Long press on an empty inventory cell: `touch.SetLongPressEvent` callbacks get a sixth
|
||||
argument, `isEmpty`. `ItemActionSheet` offers Sort / Close. Sort fires the original
|
||||
`separateButton` event, which opens the question and then sends `/click_sort_items`.
|
||||
Cells covered by a larger item and empty cells in other windows still press normally.
|
||||
- Checked, no change needed: every quick-slot tap uses the slot once (select on button
|
||||
down; the double click goes to `OnUseSlot`, and quick-slot discs have no use event).
|
||||
Dropping an item on any shop slot, empty or occupied, already sells it (uishop).
|
||||
- Tests:
|
||||
- `touch_router_test` `system_edges`;
|
||||
- `inventory_touch_test`: long-press empty cell → Sort → question → `/click_sort_items`;
|
||||
- `touch_game_test` now keeps its assert()s in release builds.
|
||||
- Desktop ctest 59/59.
|
||||
- Verified on the device: long press on an empty bag cell → Sort / Close → the original
|
||||
sort question.
|
||||
|
||||
Outstanding:
|
||||
- the system-edge strip and joystick re-acquire are covered by unit tests only, not yet
|
||||
exercised by hand on the phone;
|
||||
- hold-to-repeat on quick slots (d2r's held potion) is not done.
|
||||
|
||||
Reference in New Issue
Block a user