mirror of
https://github.com/edubart/otclient.git
synced 2025-10-14 11:34:54 +02:00
init move items
This commit is contained in:
@@ -1,3 +1,29 @@
|
||||
function UIItem:onDragEnter(mousePos)
|
||||
local item = self:getItem()
|
||||
if not item then return false end
|
||||
|
||||
self.currentDragThing = item
|
||||
setTargetCursor()
|
||||
return true
|
||||
end
|
||||
|
||||
function UIItem:onDragLeave(widget, mousePos)
|
||||
self.currentDragThing = nil
|
||||
restoreCursor()
|
||||
return true
|
||||
end
|
||||
|
||||
function UIItem:onDrop(widget, mousePos)
|
||||
if not widget or not widget.currentDragThing then return false end
|
||||
|
||||
local pos = self.position
|
||||
local count = 1 -- todo make a window for it
|
||||
|
||||
Game.move(widget.currentDragThing, pos, count)
|
||||
return true
|
||||
end
|
||||
|
||||
|
||||
function UIItem:onMouseRelease(mousePosition, mouseButton)
|
||||
local item = self:getItem()
|
||||
if not item or not self:containsPoint(mousePosition) then return false end
|
||||
|
Reference in New Issue
Block a user