ui changes
* create UIResizeBorder * restore miniwindow * scroll fixes
This commit is contained in:
parent
ee869bb279
commit
060c1cf8e7
|
@ -114,11 +114,15 @@ function Terminal.init()
|
||||||
terminalWindow.onDoubleClick = function(self)
|
terminalWindow.onDoubleClick = function(self)
|
||||||
if poped then
|
if poped then
|
||||||
self:fill('parent')
|
self:fill('parent')
|
||||||
|
self:getChildById('bottomResizeBorder'):disable()
|
||||||
|
self:getChildById('rightResizeBorder'):disable()
|
||||||
poped = false
|
poped = false
|
||||||
else
|
else
|
||||||
self:breakAnchors()
|
self:breakAnchors()
|
||||||
self:resize(g_window.getWidth()/2, g_window.getHeight()/2)
|
self:resize(g_window.getWidth()/2, g_window.getHeight()/2)
|
||||||
self:move(g_window.getWidth()/2, g_window.getHeight()/2)
|
self:move(g_window.getWidth()/2, g_window.getHeight()/2)
|
||||||
|
self:getChildById('bottomResizeBorder'):enable()
|
||||||
|
self:getChildById('rightResizeBorder'):enable()
|
||||||
poped = true
|
poped = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -41,4 +41,16 @@ UIWindow
|
||||||
margin-left: 5
|
margin-left: 5
|
||||||
font: terminus-14px-bold
|
font: terminus-14px-bold
|
||||||
|
|
||||||
|
ResizeBorder
|
||||||
|
id: bottomResizeBorder
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
enabled: false
|
||||||
|
|
||||||
|
ResizeBorder
|
||||||
|
id: rightResizeBorder
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
enabled: false
|
||||||
|
|
|
@ -42,4 +42,5 @@ Module
|
||||||
dofile 'widgets/uisplitter'
|
dofile 'widgets/uisplitter'
|
||||||
dofile 'widgets/uiscrollbar'
|
dofile 'widgets/uiscrollbar'
|
||||||
dofile 'widgets/uiscrollarea'
|
dofile 'widgets/uiscrollarea'
|
||||||
|
dofile 'widgets/uiresizeborder'
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,88 @@
|
||||||
|
UIResizeBorder = extends(UIWidget)
|
||||||
|
|
||||||
|
function UIResizeBorder.create()
|
||||||
|
local resizeborder = UIResizeBorder.internalCreate()
|
||||||
|
resizeborder:setFocusable(false)
|
||||||
|
resizeborder.minimum = 0
|
||||||
|
resizeborder.maximum = 1000
|
||||||
|
return resizeborder
|
||||||
|
end
|
||||||
|
|
||||||
|
function UIResizeBorder:onHoverChange(hovered)
|
||||||
|
if hovered then
|
||||||
|
if self:getWidth() > self:getHeight() then
|
||||||
|
Mouse.setVerticalCursor()
|
||||||
|
self.vertical = true
|
||||||
|
else
|
||||||
|
Mouse.setHorizontalCursor()
|
||||||
|
self.vertical = false
|
||||||
|
end
|
||||||
|
if not self:isPressed() then
|
||||||
|
Effects.fadeIn(self)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if not self:isPressed() then
|
||||||
|
Mouse.restoreCursor()
|
||||||
|
Effects.fadeOut(self)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function UIResizeBorder:onMouseMove(mousePos, mouseMoved)
|
||||||
|
if self:isPressed() then
|
||||||
|
if self.vertical then
|
||||||
|
local delta = mousePos.y - self:getY() - self:getHeight()/2
|
||||||
|
local parent = self:getParent()
|
||||||
|
local newsize = math.min(math.max(parent:getHeight() + delta, self.minimum), self.maximum)
|
||||||
|
if newsize ~= currentMargin then
|
||||||
|
self.newsize = newsize
|
||||||
|
if not self.event or self.event:isExecuted() then
|
||||||
|
self.event = addEvent(function()
|
||||||
|
parent:setHeight(self.newsize)
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
local delta = mousePos.x - self:getX() - self:getWidth()/2
|
||||||
|
local parent = self:getParent()
|
||||||
|
local newsize = math.min(math.max(parent:getWidth() + delta, self.minimum), self.maximum)
|
||||||
|
if newsize ~= currentMargin then
|
||||||
|
self.newsize = newsize
|
||||||
|
if not self.event or self.event:isExecuted() then
|
||||||
|
self.event = addEvent(function()
|
||||||
|
parent:setWidth(self.newsize)
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function UIResizeBorder:onMouseRelease(mousePos, mouseButton)
|
||||||
|
if not self:isHovered() then
|
||||||
|
Mouse.restoreCursor()
|
||||||
|
Effects.fadeOut(self)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function UIResizeBorder:onStyleApply(styleName, styleNode)
|
||||||
|
for name,value in pairs(styleNode) do
|
||||||
|
if name == 'maximum' then
|
||||||
|
self:setMaximum(tonumber(value))
|
||||||
|
elseif name == 'minimum' then
|
||||||
|
self:setMinimum(tonumber(value))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function UIResizeBorder:setMaximum(maximum)
|
||||||
|
self.maximum = maximum
|
||||||
|
end
|
||||||
|
|
||||||
|
function UIResizeBorder:setMinimum(minimum)
|
||||||
|
self.minimum = minimum
|
||||||
|
end
|
||||||
|
|
||||||
|
function UIResizeBorder:getMaximum() return self.maximum end
|
||||||
|
function UIResizeBorder:getMinimum() return self.minimum end
|
|
@ -33,6 +33,7 @@ function UISplitter:onMouseMove(mousePos, mouseMoved)
|
||||||
if self.vertical then
|
if self.vertical then
|
||||||
local delta = mousePos.y - self:getY() - self:getHeight()/2
|
local delta = mousePos.y - self:getY() - self:getHeight()/2
|
||||||
local newMargin = self:canUpdateMargin(self:getMarginBottom() - delta)
|
local newMargin = self:canUpdateMargin(self:getMarginBottom() - delta)
|
||||||
|
local currentMargin = self:getMarginBottom()
|
||||||
if newMargin ~= currentMargin then
|
if newMargin ~= currentMargin then
|
||||||
self.newMargin = newMargin
|
self.newMargin = newMargin
|
||||||
if not self.event or self.event:isExecuted() then
|
if not self.event or self.event:isExecuted() then
|
||||||
|
@ -44,6 +45,7 @@ function UISplitter:onMouseMove(mousePos, mouseMoved)
|
||||||
else
|
else
|
||||||
local delta = mousePos.x - self:getX() - self:getWidth()/2
|
local delta = mousePos.x - self:getX() - self:getWidth()/2
|
||||||
local newMargin = self:canUpdateMargin(self:getMarginRight() - delta)
|
local newMargin = self:canUpdateMargin(self:getMarginRight() - delta)
|
||||||
|
local currentMargin = self:getMarginRight()
|
||||||
if newMargin ~= currentMargin then
|
if newMargin ~= currentMargin then
|
||||||
self.newMargin = newMargin
|
self.newMargin = newMargin
|
||||||
if not self.event or self.event:isExecuted() then
|
if not self.event or self.event:isExecuted() then
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
Splitter < UISplitter
|
||||||
|
size: 4 4
|
||||||
|
opacity: 0
|
||||||
|
background: #ffffff44
|
||||||
|
|
||||||
|
ResizeBorder < UIResizeBorder
|
||||||
|
size: 4 4
|
||||||
|
opacity: 0
|
||||||
|
background: #ffffff44
|
|
@ -30,6 +30,8 @@ Module
|
||||||
|
|
||||||
dofile 'widgets/uigamemap'
|
dofile 'widgets/uigamemap'
|
||||||
dofile 'widgets/uiitem'
|
dofile 'widgets/uiitem'
|
||||||
|
dofile 'widgets/uiminiwindow'
|
||||||
|
dofile 'widgets/uiminiwindowcontainer'
|
||||||
|
|
||||||
dofile 'creature'
|
dofile 'creature'
|
||||||
dofile 'player'
|
dofile 'player'
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
GameSidePanel < Panel
|
GameSidePanel < UIMiniWindowContainer
|
||||||
image-source: images/sidepanel.png
|
image-source: images/sidepanel.png
|
||||||
image-border: 4
|
image-border: 4
|
||||||
|
|
||||||
|
|
|
@ -10,14 +10,39 @@ MiniWindow < UIMiniWindow
|
||||||
margin-left: 6
|
margin-left: 6
|
||||||
margin-right: 6
|
margin-right: 6
|
||||||
move-policy: free updated
|
move-policy: free updated
|
||||||
image-source: /core_styles/styles/images/mini_window.png
|
image-source: /game/images/miniwindow.png
|
||||||
image-border: 4
|
image-border: 4
|
||||||
image-border-top: 23
|
image-border-top: 23
|
||||||
padding: 25 8 2 8
|
image-border-left: 23
|
||||||
|
|
||||||
$on:
|
$on:
|
||||||
height: 24
|
height: 24
|
||||||
image-border-bottom: 1
|
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
|
BorderlessGameWindow < UIWindow
|
||||||
focusable: false
|
focusable: false
|
|
@ -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
|
return container
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function UIMiniWindowContainer:onDrop(widget, mousePos)
|
||||||
|
print 'drop'
|
||||||
|
end
|
||||||
|
|
||||||
function UIMiniWindowContainer:getClassName()
|
function UIMiniWindowContainer:getClassName()
|
||||||
return 'UIMiniWindowContainer'
|
return 'UIMiniWindowContainer'
|
||||||
end
|
end
|
||||||
|
|
|
@ -13,7 +13,7 @@ function Inventory.init()
|
||||||
|
|
||||||
Keyboard.bindKeyDown('Ctrl+I', Inventory.toggle)
|
Keyboard.bindKeyDown('Ctrl+I', Inventory.toggle)
|
||||||
|
|
||||||
inventoryWindow = displayUI('inventory.otui', GameInterface.getRightPanel())
|
inventoryWindow = displayUI('inventory.otui', GameInterface.getRightPanel()):getChildById('inventoryWindow')
|
||||||
inventoryButton = TopMenu.addGameToggleButton('inventoryButton', 'Inventory (Ctrl+I)', 'inventory.png', Inventory.toggle)
|
inventoryButton = TopMenu.addGameToggleButton('inventoryButton', 'Inventory (Ctrl+I)', 'inventory.png', Inventory.toggle)
|
||||||
inventoryButton:setOn(true)
|
inventoryButton:setOn(true)
|
||||||
|
|
||||||
|
|
|
@ -1,111 +1,113 @@
|
||||||
BorderlessGameWindow
|
MiniWindow
|
||||||
id: inventoryWindow
|
text: Inventory
|
||||||
|
icon: inventory.png
|
||||||
width: 192
|
width: 192
|
||||||
height: 154
|
height: 154
|
||||||
margin-top: 10
|
|
||||||
margin-left: 6
|
|
||||||
margin-right: 6
|
|
||||||
|
|
||||||
Item
|
MiniWindowContents
|
||||||
// head
|
id: inventoryWindow
|
||||||
id: slot1
|
|
||||||
anchors.top: parent.top
|
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
|
||||||
&position: {x=65535, y=1, z=0}
|
|
||||||
|
|
||||||
Item
|
Item
|
||||||
// armor
|
// head
|
||||||
id: slot4
|
id: slot1
|
||||||
anchors.top: prev.bottom
|
anchors.top: parent.top
|
||||||
anchors.horizontalCenter: prev.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
margin-top: 5
|
&position: {x=65535, y=1, z=0}
|
||||||
&position: {x=65535, y=4, z=0}
|
|
||||||
|
|
||||||
Item
|
Item
|
||||||
// legs
|
// armor
|
||||||
id: slot7
|
id: slot4
|
||||||
anchors.top: prev.bottom
|
anchors.top: prev.bottom
|
||||||
anchors.horizontalCenter: prev.horizontalCenter
|
anchors.horizontalCenter: prev.horizontalCenter
|
||||||
margin-top: 5
|
margin-top: 5
|
||||||
&position: {x=65535, y=7, z=0}
|
&position: {x=65535, y=4, z=0}
|
||||||
|
|
||||||
Item
|
Item
|
||||||
// feet
|
// legs
|
||||||
id: slot8
|
id: slot7
|
||||||
anchors.top: prev.bottom
|
anchors.top: prev.bottom
|
||||||
anchors.horizontalCenter: prev.horizontalCenter
|
anchors.horizontalCenter: prev.horizontalCenter
|
||||||
margin-top: 5
|
margin-top: 5
|
||||||
&position: {x=65535, y=8, z=0}
|
&position: {x=65535, y=7, z=0}
|
||||||
|
|
||||||
Item
|
Item
|
||||||
// necklace
|
// feet
|
||||||
id: slot2
|
id: slot8
|
||||||
anchors.top: parent.top
|
anchors.top: prev.bottom
|
||||||
anchors.right: slot1.left
|
anchors.horizontalCenter: prev.horizontalCenter
|
||||||
margin-top: 10
|
margin-top: 5
|
||||||
margin-right: 5
|
margin-bottom: 10
|
||||||
&position: {x=65535, y=2, z=0}
|
&position: {x=65535, y=8, z=0}
|
||||||
|
|
||||||
Item
|
Item
|
||||||
// left
|
// necklace
|
||||||
id: slot6
|
id: slot2
|
||||||
anchors.top: prev.bottom
|
anchors.top: parent.top
|
||||||
anchors.horizontalCenter: prev.horizontalCenter
|
anchors.right: slot1.left
|
||||||
margin-top: 5
|
margin-top: 10
|
||||||
&position: {x=65535, y=6, z=0}
|
margin-right: 5
|
||||||
|
&position: {x=65535, y=2, z=0}
|
||||||
|
|
||||||
Item
|
Item
|
||||||
// ring
|
// left
|
||||||
id: slot9
|
id: slot6
|
||||||
anchors.top: prev.bottom
|
anchors.top: prev.bottom
|
||||||
anchors.horizontalCenter: prev.horizontalCenter
|
anchors.horizontalCenter: prev.horizontalCenter
|
||||||
margin-top: 5
|
margin-top: 5
|
||||||
&position: {x=65535, y=9, z=0}
|
&position: {x=65535, y=6, z=0}
|
||||||
|
|
||||||
Item
|
Item
|
||||||
// backpack
|
// ring
|
||||||
id: slot3
|
id: slot9
|
||||||
anchors.top: parent.top
|
anchors.top: prev.bottom
|
||||||
anchors.left: slot1.right
|
anchors.horizontalCenter: prev.horizontalCenter
|
||||||
margin-top: 10
|
margin-top: 5
|
||||||
margin-left: 5
|
&position: {x=65535, y=9, z=0}
|
||||||
&position: {x=65535, y=3, z=0}
|
|
||||||
|
|
||||||
Item
|
Item
|
||||||
// right
|
// backpack
|
||||||
id: slot5
|
id: slot3
|
||||||
anchors.top: prev.bottom
|
anchors.top: parent.top
|
||||||
anchors.horizontalCenter: prev.horizontalCenter
|
anchors.left: slot1.right
|
||||||
margin-top: 5
|
margin-top: 10
|
||||||
&position: {x=65535, y=5, z=0}
|
margin-left: 5
|
||||||
|
&position: {x=65535, y=3, z=0}
|
||||||
|
|
||||||
Item
|
Item
|
||||||
// ammo
|
// right
|
||||||
id: slot10
|
id: slot5
|
||||||
anchors.top: prev.bottom
|
anchors.top: prev.bottom
|
||||||
anchors.horizontalCenter: prev.horizontalCenter
|
anchors.horizontalCenter: prev.horizontalCenter
|
||||||
margin-top: 5
|
margin-top: 5
|
||||||
&position: {x=65535, y=10, z=0}
|
&position: {x=65535, y=5, z=0}
|
||||||
|
|
||||||
GameLabel
|
Item
|
||||||
id: soul
|
// ammo
|
||||||
anchors.top: slot9.bottom
|
id: slot10
|
||||||
anchors.bottom: slot8.bottom
|
anchors.top: prev.bottom
|
||||||
anchors.left: slot9.left
|
anchors.horizontalCenter: prev.horizontalCenter
|
||||||
anchors.right: slot9.right
|
margin-top: 5
|
||||||
margin-top: 5
|
&position: {x=65535, y=10, z=0}
|
||||||
text-align: center
|
|
||||||
image-source: /core_styles/styles/images/panel_flat.png
|
|
||||||
image-border: 1
|
|
||||||
|
|
||||||
GameLabel
|
GameLabel
|
||||||
id: capacity
|
id: soul
|
||||||
anchors.top: slot10.bottom
|
anchors.top: slot9.bottom
|
||||||
anchors.bottom: slot8.bottom
|
anchors.bottom: slot8.bottom
|
||||||
anchors.left: slot10.left
|
anchors.left: slot9.left
|
||||||
anchors.right: slot10.right
|
anchors.right: slot9.right
|
||||||
margin-top: 5
|
margin-top: 5
|
||||||
text-align: center
|
text-align: center
|
||||||
image-source: /core_styles/styles/images/panel_flat.png
|
image-source: /core_styles/styles/images/panel_flat.png
|
||||||
image-border: 1
|
image-border: 1
|
||||||
|
|
||||||
|
GameLabel
|
||||||
|
id: capacity
|
||||||
|
anchors.top: slot10.bottom
|
||||||
|
anchors.bottom: slot8.bottom
|
||||||
|
anchors.left: slot10.left
|
||||||
|
anchors.right: slot10.right
|
||||||
|
margin-top: 5
|
||||||
|
text-align: center
|
||||||
|
image-source: /core_styles/styles/images/panel_flat.png
|
||||||
|
image-border: 1
|
||||||
|
|
||||||
|
|
|
@ -155,6 +155,23 @@ void UIAnchorLayout::updateWidget(const UIWidgetPtr& widget, UIAnchorGroup& anch
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(hookedWidget == parentWidget) {
|
||||||
|
switch(anchor.getHookedEdge()) {
|
||||||
|
case Fw::AnchorLeft:
|
||||||
|
case Fw::AnchorRight:
|
||||||
|
case Fw::AnchorHorizontalCenter:
|
||||||
|
point -= parentWidget->getVirtualOffset().x;
|
||||||
|
break;
|
||||||
|
case Fw::AnchorBottom:
|
||||||
|
case Fw::AnchorTop:
|
||||||
|
case Fw::AnchorVerticalCenter:
|
||||||
|
point -= parentWidget->getVirtualOffset().y;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch(anchor.getAnchoredEdge()) {
|
switch(anchor.getAnchoredEdge()) {
|
||||||
case Fw::AnchorHorizontalCenter:
|
case Fw::AnchorHorizontalCenter:
|
||||||
newRect.moveHorizontalCenter(point + widget->getMarginLeft() - widget->getMarginRight());
|
newRect.moveHorizontalCenter(point + widget->getMarginLeft() - widget->getMarginRight());
|
||||||
|
@ -197,7 +214,6 @@ void UIAnchorLayout::updateWidget(const UIWidgetPtr& widget, UIAnchorGroup& anch
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
newRect.translate(-parentWidget->getVirtualOffset());
|
|
||||||
widget->setRect(newRect);
|
widget->setRect(newRect);
|
||||||
anchorGroup.setUpdated(true);
|
anchorGroup.setUpdated(true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -902,19 +902,35 @@ Rect UIWidget::getClippingRect()
|
||||||
return rect;
|
return rect;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Rect UIWidget::getMarginRect()
|
||||||
|
{
|
||||||
|
Rect rect = m_rect;
|
||||||
|
rect.expand(m_margin.top, m_margin.right, m_margin.bottom, m_margin.left);
|
||||||
|
return rect;
|
||||||
|
}
|
||||||
|
|
||||||
Rect UIWidget::getChildrenRect()
|
Rect UIWidget::getChildrenRect()
|
||||||
{
|
{
|
||||||
Rect childrenRect;
|
Rect childrenRect;
|
||||||
for(const UIWidgetPtr& child : m_children) {
|
for(const UIWidgetPtr& child : m_children) {
|
||||||
if(!child->isExplicitlyVisible() || !child->getRect().isValid() || child->getOpacity() == 0.0f)
|
if(!child->isExplicitlyVisible() || !child->getRect().isValid())
|
||||||
continue;
|
continue;
|
||||||
|
Rect marginRect = child->getMarginRect();
|
||||||
if(!childrenRect.isValid())
|
if(!childrenRect.isValid())
|
||||||
childrenRect = child->getRect();
|
childrenRect = marginRect;
|
||||||
else
|
else
|
||||||
childrenRect = childrenRect.united(child->getRect());
|
childrenRect = childrenRect.united(marginRect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Rect myClippingRect = getClippingRect();
|
||||||
if(!childrenRect.isValid())
|
if(!childrenRect.isValid())
|
||||||
childrenRect = getClippingRect();
|
childrenRect = myClippingRect;
|
||||||
|
else {
|
||||||
|
if(childrenRect.width() < myClippingRect.width())
|
||||||
|
childrenRect.setWidth(myClippingRect.width());
|
||||||
|
if(childrenRect.height() < myClippingRect.height())
|
||||||
|
childrenRect.setHeight(myClippingRect.height());
|
||||||
|
}
|
||||||
return childrenRect;
|
return childrenRect;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -134,6 +134,7 @@ public:
|
||||||
bool hasChild(const UIWidgetPtr& child);
|
bool hasChild(const UIWidgetPtr& child);
|
||||||
int getChildIndex(const UIWidgetPtr& child);
|
int getChildIndex(const UIWidgetPtr& child);
|
||||||
Rect getClippingRect();
|
Rect getClippingRect();
|
||||||
|
Rect getMarginRect();
|
||||||
Rect getChildrenRect();
|
Rect getChildrenRect();
|
||||||
UIAnchorLayoutPtr getAnchoredLayout();
|
UIAnchorLayoutPtr getAnchoredLayout();
|
||||||
UIWidgetPtr getRootParent();
|
UIWidgetPtr getRootParent();
|
||||||
|
|
Loading…
Reference in New Issue