mirror of
https://github.com/edubart/otclient.git
synced 2025-10-14 11:34:54 +02:00
merge revgraphics
This commit is contained in:
@@ -13,7 +13,7 @@ local function moveToolTip(tooltip)
|
||||
else
|
||||
pos.x = pos.x + 10
|
||||
end
|
||||
tooltip:setPos(pos)
|
||||
tooltip:setPosition(pos)
|
||||
end
|
||||
|
||||
-- public functions
|
||||
|
@@ -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,28 +13,32 @@ 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
|
||||
|
||||
|
||||
restoreCursor()
|
||||
self:setBorderWidth(0)
|
||||
return true
|
||||
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()
|
||||
if widget.currentDragThing:isStackable() and data > 1 then
|
||||
local count = widget.currentDragThing:getCount()
|
||||
if widget.currentDragThing:isStackable() and count > 1 then
|
||||
widget.parsed = true
|
||||
local moveWindow = displayUI('/game/movewindow.otui')
|
||||
local spinbox = moveWindow:getChildById('spinbox')
|
||||
spinbox:setMaximum(data)
|
||||
spinbox:setMaximum(count)
|
||||
spinbox:setMinimum(1)
|
||||
spinbox:setCurrentIndex(data)
|
||||
|
||||
spinbox:setCurrentIndex(count)
|
||||
|
||||
local okButton = moveWindow:getChildById('buttonOk')
|
||||
okButton.onClick = function() Game.move(widget.currentDragThing, pos, spinbox:getCurrentIndex()) okButton:getParent():destroy() widget.currentDragThing = nil end
|
||||
moveWindow.onEnter = okButton.onClick
|
||||
@@ -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)
|
||||
|
@@ -65,7 +65,7 @@ function UIPopupMenu:onKeyPress(keyCode, keyboardModifiers, wouldFilter)
|
||||
return false
|
||||
end
|
||||
|
||||
-- close all menus when the window is resized
|
||||
-- close all menus when the window is resized
|
||||
local function onRootGeometryUpdate()
|
||||
for i,menu in ipairs(displayedMenuList) do
|
||||
menu:destroy()
|
||||
|
Reference in New Issue
Block a user