mirror of
https://github.com/edubart/otclient.git
synced 2025-10-16 04:24:54 +02:00
ui changes
* create UIResizeBorder * restore miniwindow * scroll fixes
This commit is contained in:
@@ -155,6 +155,23 @@ void UIAnchorLayout::updateWidget(const UIWidgetPtr& widget, UIAnchorGroup& anch
|
||||
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()) {
|
||||
case Fw::AnchorHorizontalCenter:
|
||||
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);
|
||||
anchorGroup.setUpdated(true);
|
||||
}
|
||||
|
@@ -902,19 +902,35 @@ Rect UIWidget::getClippingRect()
|
||||
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 childrenRect;
|
||||
for(const UIWidgetPtr& child : m_children) {
|
||||
if(!child->isExplicitlyVisible() || !child->getRect().isValid() || child->getOpacity() == 0.0f)
|
||||
if(!child->isExplicitlyVisible() || !child->getRect().isValid())
|
||||
continue;
|
||||
Rect marginRect = child->getMarginRect();
|
||||
if(!childrenRect.isValid())
|
||||
childrenRect = child->getRect();
|
||||
childrenRect = marginRect;
|
||||
else
|
||||
childrenRect = childrenRect.united(child->getRect());
|
||||
childrenRect = childrenRect.united(marginRect);
|
||||
}
|
||||
|
||||
Rect myClippingRect = getClippingRect();
|
||||
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;
|
||||
}
|
||||
|
||||
|
@@ -134,6 +134,7 @@ public:
|
||||
bool hasChild(const UIWidgetPtr& child);
|
||||
int getChildIndex(const UIWidgetPtr& child);
|
||||
Rect getClippingRect();
|
||||
Rect getMarginRect();
|
||||
Rect getChildrenRect();
|
||||
UIAnchorLayoutPtr getAnchoredLayout();
|
||||
UIWidgetPtr getRootParent();
|
||||
|
Reference in New Issue
Block a user