mirror of
https://github.com/edubart/otclient.git
synced 2025-10-14 19:44:54 +02:00
ui changes
* create UIResizeBorder * restore miniwindow * scroll fixes
This commit is contained in:
@@ -30,6 +30,8 @@ Module
|
||||
|
||||
dofile 'widgets/uigamemap'
|
||||
dofile 'widgets/uiitem'
|
||||
dofile 'widgets/uiminiwindow'
|
||||
dofile 'widgets/uiminiwindowcontainer'
|
||||
|
||||
dofile 'creature'
|
||||
dofile 'player'
|
||||
|
@@ -1,4 +1,4 @@
|
||||
GameSidePanel < Panel
|
||||
GameSidePanel < UIMiniWindowContainer
|
||||
image-source: images/sidepanel.png
|
||||
image-border: 4
|
||||
|
||||
|
@@ -10,14 +10,39 @@ MiniWindow < UIMiniWindow
|
||||
margin-left: 6
|
||||
margin-right: 6
|
||||
move-policy: free updated
|
||||
image-source: /core_styles/styles/images/mini_window.png
|
||||
image-source: /game/images/miniwindow.png
|
||||
image-border: 4
|
||||
image-border-top: 23
|
||||
padding: 25 8 2 8
|
||||
image-border-left: 23
|
||||
|
||||
$on:
|
||||
height: 24
|
||||
image-border-bottom: 1
|
||||
|
||||
ResizeBorder
|
||||
id: bottomResizeBorder
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
height: 2
|
||||
margin-bottom: 1
|
||||
minimum: 70
|
||||
|
||||
VerticalScrollBar
|
||||
id: miniwindowScrollBar
|
||||
anchors.top: parent.top
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.right: parent.right
|
||||
step: 14
|
||||
margin-top: 22
|
||||
margin-right: 2
|
||||
margin-bottom: 2
|
||||
fade-effect: false
|
||||
|
||||
MiniWindowContents < ScrollablePanel
|
||||
anchors.fill: parent
|
||||
padding: 25 21 2 8
|
||||
vertical-scrollbar: miniwindowScrollBar
|
||||
|
||||
BorderlessGameWindow < UIWindow
|
||||
focusable: false
|
||||
focusable: false
|
||||
|
36
modules/game/widgets/uiminiwindow.lua
Normal file
36
modules/game/widgets/uiminiwindow.lua
Normal file
@@ -0,0 +1,36 @@
|
||||
UIMiniWindow = extends(UIWindow)
|
||||
|
||||
function UIMiniWindow.create()
|
||||
local miniwindow = UIMiniWindow.internalCreate()
|
||||
return miniwindow
|
||||
end
|
||||
|
||||
function UIMiniWindow:onDragEnter(mousePos)
|
||||
local parent = self:getParent()
|
||||
if not parent then return false end
|
||||
|
||||
if parent:getClassName() == 'UIMiniWindowContainer' then
|
||||
local containerParent = parent:getParent()
|
||||
parent:removeChild(self)
|
||||
containerParent:addChild(self)
|
||||
end
|
||||
|
||||
local oldPos = self:getPosition()
|
||||
self.movingReference = { x = mousePos.x - oldPos.x, y = mousePos.y - oldPos.y }
|
||||
self:setPosition(oldPos)
|
||||
return true
|
||||
end
|
||||
|
||||
function UIMiniWindow:onDragLeave(droppedWidget, mousePos)
|
||||
-- TODO: drop on other interfaces
|
||||
end
|
||||
|
||||
function UIMiniWindow:onFocusChange(focused)
|
||||
-- miniwindows only raises when its outside MiniWindowContainers
|
||||
if not focused then return end
|
||||
local parent = self:getParent()
|
||||
if parent and parent:getClassName() ~= 'UIMiniWindowContainer' then
|
||||
self:raise()
|
||||
end
|
||||
end
|
||||
|
@@ -7,6 +7,10 @@ function UIMiniWindowContainer.create()
|
||||
return container
|
||||
end
|
||||
|
||||
function UIMiniWindowContainer:onDrop(widget, mousePos)
|
||||
print 'drop'
|
||||
end
|
||||
|
||||
function UIMiniWindowContainer:getClassName()
|
||||
return 'UIMiniWindowContainer'
|
||||
end
|
||||
|
Reference in New Issue
Block a user