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
@@ -211,12 +211,22 @@ int main(int argc, char** argv) {
|
||||
runtime.execute("assert not sheet.IsShow() and not calls, ('outside', sheet.IsShow(), calls)\n"
|
||||
"assert not mouseModule.mouseController.isAttached(), 'outside attached'\n");
|
||||
|
||||
// Long press on an empty cell is an ordinary press.
|
||||
// Long press on an empty cell offers the original sort (separateButton -> question ->
|
||||
// /click_sort_items); the sheet's Close button leaves the bag alone.
|
||||
runtime.execute("net.SendChatPacket = lambda *a: calls.append(('chat',) + a)\n");
|
||||
router.FingerDown(0, x5, y5, now);
|
||||
router.Update(now + 500);
|
||||
runtime.execute("assert not sheet.IsShow(), 'empty long'\n");
|
||||
router.FingerUp(0, x5, y5, now + 600);
|
||||
now += 1000;
|
||||
runtime.execute("assert sheet.IsShow() and len(sheet.buttons) == 2, ('empty long', sheet.IsShow(), len(sheet.buttons))\n"
|
||||
"assert not mouseModule.mouseController.isAttached() and not calls, calls\n");
|
||||
button(0, bx, by);
|
||||
Tap(router, bx, by); // Sort
|
||||
runtime.execute("assert not sheet.IsShow(), 'sort closes'\n"
|
||||
"assert inv.question and inv.question.IsShow(), 'sort question'\n"
|
||||
"inv.question.acceptButton.CallEvent() if hasattr(inv.question, 'acceptButton') else inv.ClickSort()\n"
|
||||
"assert ('chat', '/click_sort_items') in calls, calls\n"
|
||||
"del calls[:]\n");
|
||||
|
||||
// Desktop keyboard state reaches app.IsPressed (Shift-split, Ctrl-quickslot on PC).
|
||||
ava2::SetKeyPressed(42, true);
|
||||
|
||||
Reference in New Issue
Block a user