mirror of
https://github.com/edubart/otclient.git
synced 2025-10-15 12:04:55 +02:00
restore old modules
* partially restore vip, battle, healthbar, skills and inventory modules * more fixes on UIWidgets * implement UIMiniWindow close/minimize functionality * allow drag and drop miniwindows beteween game panels
This commit is contained in:
@@ -27,7 +27,7 @@ end
|
||||
function UIItem:onDrop(widget, mousePos)
|
||||
if self:isVirtual() then return false end
|
||||
|
||||
if not widget or not widget.currentDragThing then return true end
|
||||
if not widget or not widget.currentDragThing then return false end
|
||||
|
||||
local pos = self.position
|
||||
local count = widget.currentDragThing:getCount()
|
||||
|
@@ -2,10 +2,16 @@ UIMiniWindow = extends(UIWindow)
|
||||
|
||||
function UIMiniWindow.create()
|
||||
local miniwindow = UIMiniWindow.internalCreate()
|
||||
miniwindow:setFocusable(false)
|
||||
return miniwindow
|
||||
end
|
||||
|
||||
function UIMiniWindow:onSetup()
|
||||
addEvent(function()
|
||||
self:getChildById('closeButton').onClick = function() signalcall(self.onClose, self) end
|
||||
self:getChildById('minimizeButton').onClick = function() signalcall(self.onMinimize, self) end
|
||||
end)
|
||||
end
|
||||
|
||||
function UIMiniWindow:onDragEnter(mousePos)
|
||||
local parent = self:getParent()
|
||||
if not parent then return false end
|
||||
@@ -19,9 +25,19 @@ function UIMiniWindow:onDragEnter(mousePos)
|
||||
local oldPos = self:getPosition()
|
||||
self.movingReference = { x = mousePos.x - oldPos.x, y = mousePos.y - oldPos.y }
|
||||
self:setPosition(oldPos)
|
||||
self.free = true
|
||||
return true
|
||||
end
|
||||
|
||||
function UIMiniWindow:onMousePress()
|
||||
local parent = self:getParent()
|
||||
if not parent then return false end
|
||||
if parent:getClassName() ~= 'UIMiniWindowContainer' then
|
||||
self:raise()
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
function UIMiniWindow:onDragLeave(droppedWidget, mousePos)
|
||||
-- TODO: drop on other interfaces
|
||||
end
|
||||
@@ -35,3 +51,25 @@ function UIMiniWindow:onFocusChange(focused)
|
||||
end
|
||||
end
|
||||
|
||||
function UIMiniWindow:onClose()
|
||||
end
|
||||
|
||||
function UIMiniWindow:onMinimize()
|
||||
if self:isOn() then
|
||||
self:setOn(false)
|
||||
self:getChildById('contentsPanel'):show()
|
||||
self:getChildById('miniwindowScrollBar'):show()
|
||||
self:getChildById('bottomResizeBorder'):show()
|
||||
self:getChildById('minimizeButton'):setOn(false)
|
||||
self:setHeight(self.savedHeight)
|
||||
else
|
||||
self.savedHeight = self:getHeight()
|
||||
self:setHeight(self.minimizedHeight)
|
||||
self:setOn(true)
|
||||
self:getChildById('contentsPanel'):hide()
|
||||
self:getChildById('miniwindowScrollBar'):hide()
|
||||
self:getChildById('bottomResizeBorder'):hide()
|
||||
self:getChildById('minimizeButton'):setOn(true)
|
||||
end
|
||||
end
|
||||
|
||||
|
@@ -8,7 +8,8 @@ function UIMiniWindowContainer.create()
|
||||
end
|
||||
|
||||
function UIMiniWindowContainer:onDrop(widget, mousePos)
|
||||
print 'drop'
|
||||
widget:setParent(self)
|
||||
return true
|
||||
end
|
||||
|
||||
function UIMiniWindowContainer:getClassName()
|
||||
|
Reference in New Issue
Block a user