2012-01-20 02:12:26 +01:00
|
|
|
function UIItem:onDragEnter(mousePos)
|
|
|
|
local item = self:getItem()
|
|
|
|
if not item then return false end
|
2012-01-20 03:48:38 +01:00
|
|
|
|
2012-01-20 02:12:26 +01:00
|
|
|
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
|
2012-01-20 03:48:38 +01:00
|
|
|
|
2012-01-20 02:12:26 +01:00
|
|
|
local pos = self.position
|
|
|
|
local count = 1 -- todo make a window for it
|
2012-01-20 03:48:38 +01:00
|
|
|
|
2012-01-20 02:12:26 +01:00
|
|
|
Game.move(widget.currentDragThing, pos, count)
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
|
|
|
|
|
2012-01-13 01:31:39 +01:00
|
|
|
function UIItem:onMouseRelease(mousePosition, mouseButton)
|
|
|
|
local item = self:getItem()
|
|
|
|
if not item or not self:containsPoint(mousePosition) then return false end
|
|
|
|
return Game.processMouseAction(mousePosition, mouseButton, nil, item, item, nil, item)
|
|
|
|
end
|
|
|
|
|