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:
co-authored by
Claude Opus 5.5
parent
908838c8f9
commit
6244b1d860
@@ -772,7 +772,7 @@ namespace UI
|
||||
void RestoreSlotCoolTime(DWORD dwKey);
|
||||
void ActivateSlot(DWORD dwIndex);
|
||||
void DeactivateSlot(DWORD dwIndex);
|
||||
void RefreshSlot() {}
|
||||
void RefreshSlot();
|
||||
DWORD GetSlotCount() { return (DWORD)m_slotMap.size(); }
|
||||
void LockSlot(DWORD dwIndex);
|
||||
void UnlockSlot(DWORD dwIndex);
|
||||
@@ -803,10 +803,33 @@ namespace UI
|
||||
|
||||
BOOL GetSlotPointer(DWORD dwIndex, SSlot** ppSlot);
|
||||
BOOL GetSelectedSlotPointer(SSlot** ppSlot);
|
||||
// The slot under the mouse (EterPythonLib/PythonSlotWindow.cpp GetPickedSlotPointer).
|
||||
virtual BOOL GetPickedSlotPointer(SSlot** ppSlot);
|
||||
|
||||
// Mouse events and their Python callbacks (EterPythonLib/PythonSlotWindow.cpp).
|
||||
BOOL OnMouseLeftButtonDown() override;
|
||||
BOOL OnMouseLeftButtonUp() override;
|
||||
BOOL OnMouseRightButtonDown() override;
|
||||
BOOL OnMouseLeftButtonDoubleClick() override;
|
||||
void OnMouseOverOut() override;
|
||||
void OnMouseOver() override;
|
||||
|
||||
void OnSelectEmptySlot(int iSlotNumber);
|
||||
void OnSelectItemSlot(int iSlotNumber);
|
||||
void OnUnselectEmptySlot(int iSlotNumber);
|
||||
void OnUnselectItemSlot(int iSlotNumber);
|
||||
void OnUseSlot();
|
||||
BOOL OnOverIn(DWORD dwSlotNumber);
|
||||
void OnOverOut();
|
||||
BOOL OnOverInItem(DWORD dwSlotNumber);
|
||||
void OnOverOutItem();
|
||||
|
||||
static constexpr DWORD SLOT_NUMBER_NONE = 0xffffffff;
|
||||
|
||||
protected:
|
||||
void OnRender() override;
|
||||
BOOL OnIsType(DWORD dwType) override;
|
||||
virtual void OnRefreshSlot() {}
|
||||
virtual void OnRenderPickingSlot();
|
||||
virtual void OnRenderSelectedSlot();
|
||||
void RenderSlotBaseImage();
|
||||
@@ -817,6 +840,8 @@ namespace UI
|
||||
DWORD m_dwSlotStyle;
|
||||
BOOL m_isUseMode;
|
||||
BOOL m_isUsableItem;
|
||||
DWORD m_dwToolTipSlotNumber = SLOT_NUMBER_NONE;
|
||||
DWORD m_dwOverInSlotNumber = SLOT_NUMBER_NONE;
|
||||
std::vector<DWORD> m_slots;
|
||||
std::vector<DWORD> m_dwSelectedSlotIndexList;
|
||||
std::map<DWORD, SSlot> m_slotMap;
|
||||
@@ -833,10 +858,17 @@ namespace UI
|
||||
virtual ~CGridSlotWindow();
|
||||
void ArrangeGridSlot(DWORD dwStartIndex, DWORD dwxCount, DWORD dwyCount, int ixSlotSize, int iySlotSize, int ixTemporarySize, int iyTemporarySize);
|
||||
BOOL GetPickedSlotList(BYTE byWidth, BYTE byHeight, std::vector<SSlot*>* pSlotList);
|
||||
BOOL GetPickedSlotPointer(SSlot** ppSlot);
|
||||
BOOL GetPickedSlotPointer(SSlot** ppSlot) override;
|
||||
BOOL CheckMoving(DWORD dwSlotNumber, DWORD dwItemIndex, const std::vector<SSlot*>& slotList);
|
||||
protected:
|
||||
void OnRenderPickingSlot() override;
|
||||
BOOL OnIsType(DWORD dwType) override;
|
||||
void OnRefreshSlot() override;
|
||||
BOOL GetGridSlotPointer(int ix, int iy, SSlot** ppSlot);
|
||||
BOOL GetPickedGridSlotPosition(int ixLocal, int iyLocal, int* pix, int* piy);
|
||||
|
||||
DWORD m_dwxCount = 0, m_dwyCount = 0;
|
||||
// Slot numbers by grid cell x + y * m_dwxCount (the original keeps slot pointers).
|
||||
std::vector<DWORD> m_SlotVector;
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user