drag fixes

This commit is contained in:
Eduardo Bart
2012-02-07 00:06:48 -02:00
parent 53ead20de5
commit 71c706157a
5 changed files with 11 additions and 11 deletions

View File

@@ -53,9 +53,11 @@ end
function UIItem:onHoverChange(hovered)
if self:isVirtual() then return end
local dragginWidget = g_ui.getDraggingWidget()
if dragginWidget and self ~= dragginWidget then
if dragginWidget:getClassName() == 'UIItem' and not dragginWidget:isVirtual() and hovered then
local draggingWidget = g_ui.getDraggingWidget()
if draggingWidget and self ~= draggingWidget then
local gotMap = draggingWidget:getClassName() == 'UIMap'
local gotItem = draggingWidget:getClassName() == 'UIItem' and not draggingWidget:isVirtual()
if hovered and (gotItem or gotMap) then
self:setBorderWidth(1)
else
self:setBorderWidth(0)

View File

@@ -11,7 +11,7 @@ function UIMap:onDragEnter(mousePos)
return true
end
function UIMap:onDragLeave(widget, mousePos)
function UIMap:onDragLeave(droppedWidget, mousePos)
if not self.parsed then
self.currentDragThing = nil
end
@@ -27,7 +27,7 @@ function UIMap:onDrop(widget, mousePos)
if not tile then return false end
local count = widget.currentDragThing:getCount()
if widget.currentDragThing:isStackable() and data > 1 then
if widget.currentDragThing:isStackable() and count > 1 then
widget.parsed = true
local moveWindow = displayUI('/game/movewindow.otui')
local spinbox = moveWindow:getChildById('spinbox')