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
@@ -141,10 +141,21 @@ Python 更新(原版脚本 + mobile HUD)
|
||||
| 拖动(超过 tap_slop) | 在起点按下左键,随后跟随移动,抬起即松开 | 原版拖拽:换格、拖到装备栏、拖出窗口丢弃、拖到商店出售 |
|
||||
| 双击(300 ms、40 px 内) | 原版左键双击 | `OnUseSlot`:使用药水、穿戴/卸下装备 |
|
||||
| 长按物品格(450 ms) | `touch.SetLongPressEvent` 回调 | 提示保持显示,弹出 `ui_mobile_actions.ItemActionSheet`:使用、拆分、加入快捷栏、关闭 |
|
||||
| 长按背包空格子(450 ms) | 同一回调,`isEmpty=1` | 面板只有“整理”和“关闭”;整理调用原版整理按钮 `separateButton` 的事件(确认框 → `/click_sort_items`) |
|
||||
|
||||
- 长按面板的按钮调用原版槽位事件。“使用”调用 `OnUseSlot`;“拆分”和“加入快捷栏”通过 `touch.SetVirtualKey` 临时按住 Shift / Ctrl,再调用 `OnSelectItemSlot`,走原版的修饰键分支。
|
||||
- 点面板外任意处关闭面板。长按空格子没有操作,按普通按下处理。
|
||||
- 手指抬起后指针移到屏幕外(拿着物品时除外),以免提示一直停留。
|
||||
- 点面板外任意处关闭面板。长按其他窗口的空格子、或被大件物品占住的格子,仍按普通按下处理。
|
||||
- 手指抬起后指针移到屏幕外(拿着物品时除外),以免提示一直停留。被取消的触摸、点地面(世界点击)结束后也一样。
|
||||
- 快捷栏和药水栏:每次点按的左键按下都会触发一次使用;第二下被识别成双击时只多发一个双击,快捷格没有双击事件,所以连点 N 次就是用 N 次。
|
||||
|
||||
## 系统边缘与取消
|
||||
|
||||
以下交互思路参考 [jhaizhou-ops/d2r-mobile](https://github.com/jhaizhou-ops/d2r-mobile)(MIT),只借鉴想法,没有拷贝代码:
|
||||
|
||||
- 底部安全区(手势导航条)里落下的世界手指不拖镜头,也不算点地面。
|
||||
- 系统取消某一根手指(`SDL_EVENT_FINGER_CANCELED`,例如边缘手势从它下面开始)时只释放这一根,其他手指不受影响。摇杆手指被取消后,摇杆保持原方向 `joy_reacquire_ms`(300 ms);这段时间内在原基点 1.5 倍半径内落下的手指接管摇杆,基点不变。
|
||||
- 攻击键点得比一帧还快时,松开推迟到下一帧,保证原版 player 模块至少看到一次按下。
|
||||
- 没有采用的:技能拖动瞄准(Metin2 技能按目标/朝向释放)、点面板外关闭所有窗口(点世界要移动角色)、手柄自动切换(以后再说)。
|
||||
- 技能:技能圈和底部栏是原版快捷栏格,点按即使用(第 4 步)。从技能窗口把技能拖到快捷栏用的是同一套槽位拖拽,但还没有单独测试。
|
||||
|
||||
## 目录变化
|
||||
|
||||
Reference in New Issue
Block a user