Fixed a hover bug with UIItem

This commit is contained in:
Henrique Santiago 2012-08-08 12:08:18 -03:00
parent 16a3dd2b7e
commit 05bfd00d1f
1 changed files with 10 additions and 0 deletions

View File

@ -15,6 +15,7 @@ function UIItem:onDragLeave(droppedWidget, mousePos)
self.currentDragThing = nil
g_mouse.restoreCursor()
self:setBorderWidth(0)
self.hoveredWho = nil
return true
end
@ -41,6 +42,13 @@ function UIItem:onDrop(widget, mousePos)
return true
end
function UIItem:onDestroy()
if self == g_ui.getDraggingWidget() and self.hoveredWho then
self.hoveredWho:setBorderWidth(0)
self.hoveredWho = nil
end
end
function UIItem:onHoverChange(hovered)
UIWidget.onHoverChange(self, hovered)
@ -52,8 +60,10 @@ function UIItem:onHoverChange(hovered)
local gotItem = draggingWidget:getClassName() == 'UIItem' and not draggingWidget:isVirtual()
if hovered and (gotItem or gotMap) then
self:setBorderWidth(1)
draggingWidget.hoveredWho = self
else
self:setBorderWidth(0)
draggingWidget.hoveredWho = nil
end
end
end