Mobile gestures: item tap/drag/double-tap/long-press on original windows

Port the EterPythonLib CSlotWindow/CGridSlotWindow mouse handlers
(select, drop, use, right click, tooltips, grid picking/CheckMoving) and
CWindowManager IsDragging/right button, which were missing so item
interaction did not work on desktop either. app.SetMouseHandler now
renders the attached icon, app.IsPressed reads real key state, desktop
double clicks reach the window manager.

The touch router maps UI touches to the original mouse: tap = click at
the touch-down point, drag = press-and-drag, double tap = double click,
long press on an item slot = touch.SetLongPressEvent, which opens the
ui_mobile_actions item sheet (use / split / quick slot via virtual
Shift/Ctrl). New ava2.inventory_touch test drives uiinventory.py.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
shenlei
2026-10-13 05:16:12 +09:00
co-authored by Claude Opus 5.5
parent 908838c8f9
commit 6244b1d860
17 changed files with 1301 additions and 81 deletions
+17
View File
@@ -130,6 +130,23 @@ Python 更新(原版脚本 + mobile HUD)
- 20:9 等宽屏需按安全区域布局。
- 不使用其他服务器的界面美术;图标用 AVA2 自带技能/道具图标,按钮底框和摇杆另制。
## 物品与窗口手势
原版窗口不改,触摸由 `src/app/input/touch_router` 翻译成原版鼠标事件,经窗口管理器和移植的 `CSlotWindow` 鼠标处理进入 `uiinventory.py` 等原版脚本:
| 手势 | 翻译成 | 原版效果 |
|---|---|---|
| 手指按住不动 | 鼠标移到该处 | 物品格显示原版物品提示 |
| 点按 | 在按下点依次发移动、左键按下、左键抬起 | 拿起物品(图标跟随);再点空格/装备格/其他窗口即放下、穿戴、交易放入 |
| 拖动(超过 tap_slop) | 在起点按下左键,随后跟随移动,抬起即松开 | 原版拖拽:换格、拖到装备栏、拖出窗口丢弃、拖到商店出售 |
| 双击(300 ms、40 px 内) | 原版左键双击 | `OnUseSlot`:使用药水、穿戴/卸下装备 |
| 长按物品格(450 ms) | `touch.SetLongPressEvent` 回调 | 提示保持显示,弹出 `ui_mobile_actions.ItemActionSheet`:使用、拆分、加入快捷栏、关闭 |
- 长按面板的按钮调用原版槽位事件。“使用”调用 `OnUseSlot`;“拆分”和“加入快捷栏”通过 `touch.SetVirtualKey` 临时按住 Shift / Ctrl,再调用 `OnSelectItemSlot`,走原版的修饰键分支。
- 点面板外任意处关闭面板。长按空格子没有操作,按普通按下处理。
- 手指抬起后指针移到屏幕外(拿着物品时除外),以免提示一直停留。
- 技能:技能圈和底部栏是原版快捷栏格,点按即使用(第 4 步)。从技能窗口把技能拖到快捷栏用的是同一套槽位拖拽,但还没有单独测试。
## 目录变化
- `support/android` → 顶层 `android/`(补全)。