|
|
|
@ -1,6 +1,8 @@
|
|
|
|
|
function UIItem:onDragEnter(mousePos)
|
|
|
|
|
if self:isVirtual() then return false end
|
|
|
|
|
|
|
|
|
|
local item = self:getItem()
|
|
|
|
|
if not item then return false end
|
|
|
|
|
if not item then return true end
|
|
|
|
|
|
|
|
|
|
self:setBorderWidth(1)
|
|
|
|
|
|
|
|
|
@ -11,6 +13,8 @@ function UIItem:onDragEnter(mousePos)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function UIItem:onDragLeave(widget, mousePos)
|
|
|
|
|
if self:isVirtual() then return false end
|
|
|
|
|
|
|
|
|
|
if not self.parsed then
|
|
|
|
|
self.currentDragThing = nil
|
|
|
|
|
end
|
|
|
|
@ -21,7 +25,9 @@ function UIItem:onDragLeave(widget, mousePos)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function UIItem:onDrop(widget, mousePos)
|
|
|
|
|
if not widget or not widget.currentDragThing then return false end
|
|
|
|
|
if self:isVirtual() then return false end
|
|
|
|
|
|
|
|
|
|
if not widget or not widget.currentDragThing then return true end
|
|
|
|
|
|
|
|
|
|
local pos = self.position
|
|
|
|
|
local data = widget.currentDragThing:getData()
|
|
|
|
@ -45,6 +51,8 @@ function UIItem:onDrop(widget, mousePos)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function UIItem:onHoverChange(hovered)
|
|
|
|
|
if self:isVirtual() then return end
|
|
|
|
|
|
|
|
|
|
if g_ui.getDraggingWidget() and self ~= g_ui.getDraggingWidget() then
|
|
|
|
|
if hovered then
|
|
|
|
|
self:setBorderWidth(1)
|
|
|
|
@ -55,6 +63,8 @@ function UIItem:onHoverChange(hovered)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function UIItem:onMouseRelease(mousePosition, mouseButton)
|
|
|
|
|
if self:isVirtual() then return false end
|
|
|
|
|
|
|
|
|
|
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)
|
|
|
|
|