mirror of
https://github.com/edubart/otclient.git
synced 2025-10-20 06:23:26 +02:00
scroll when focusing widgets
This commit is contained in:
@@ -140,7 +140,7 @@ bool UIAnchorLayout::updateWidget(const UIWidgetPtr& widget, UIAnchorGroup& anch
|
||||
// determine hooked widget edge point
|
||||
Rect hookedWidgetRect = hookedWidget->getRect();
|
||||
if(hookedWidget == parentWidget)
|
||||
hookedWidgetRect = parentWidget->getClippingRect();
|
||||
hookedWidgetRect = parentWidget->getPaddingRect();
|
||||
|
||||
int point = 0;
|
||||
switch(anchor.getHookedEdge()) {
|
||||
|
@@ -79,7 +79,7 @@ bool UIGridLayout::internalUpdate()
|
||||
|
||||
UIWidgetList widgets = parentWidget->getChildren();
|
||||
|
||||
Rect clippingRect = parentWidget->getClippingRect();
|
||||
Rect clippingRect = parentWidget->getPaddingRect();
|
||||
Point topLeft = clippingRect.topLeft();
|
||||
|
||||
int numColumns = m_numColumns;
|
||||
|
@@ -46,7 +46,7 @@ bool UIHorizontalLayout::internalUpdate()
|
||||
std::reverse(widgets.begin(), widgets.end());
|
||||
|
||||
bool changed = false;
|
||||
Rect clippingRect = parentWidget->getClippingRect();
|
||||
Rect clippingRect = parentWidget->getPaddingRect();
|
||||
Point pos = (m_alignRight) ? clippingRect.topRight() : clippingRect.topLeft();
|
||||
int preferredWidth = 0;
|
||||
int gap;
|
||||
|
@@ -47,7 +47,7 @@ bool UIVerticalLayout::internalUpdate()
|
||||
if(m_alignBottom)
|
||||
std::reverse(widgets.begin(), widgets.end());
|
||||
|
||||
Rect clippingRect = parentWidget->getClippingRect();
|
||||
Rect clippingRect = parentWidget->getPaddingRect();
|
||||
Point pos = (m_alignBottom) ? clippingRect.bottomLeft() : clippingRect.topLeft();
|
||||
int preferredHeight = 0;
|
||||
int gap;
|
||||
|
@@ -61,7 +61,7 @@ void UIWidget::draw(const Rect& visibleRect, bool foregroundPane)
|
||||
|
||||
if(m_children.size() > 0) {
|
||||
if(m_clipping)
|
||||
g_painter->setClipRect(visibleRect.intersection(getClippingRect()));
|
||||
g_painter->setClipRect(visibleRect.intersection(getPaddingRect()));
|
||||
|
||||
drawChildren(visibleRect, foregroundPane);
|
||||
}
|
||||
@@ -683,7 +683,7 @@ void UIWidget::bindRectToParent()
|
||||
Rect boundRect = m_rect;
|
||||
UIWidgetPtr parent = getParent();
|
||||
if(parent) {
|
||||
Rect parentRect = parent->getClippingRect();
|
||||
Rect parentRect = parent->getPaddingRect();
|
||||
boundRect.bind(parentRect);
|
||||
}
|
||||
|
||||
@@ -980,7 +980,7 @@ int UIWidget::getChildIndex(const UIWidgetPtr& child)
|
||||
return -1;
|
||||
}
|
||||
|
||||
Rect UIWidget::getClippingRect()
|
||||
Rect UIWidget::getPaddingRect()
|
||||
{
|
||||
Rect rect = m_rect;
|
||||
rect.expand(-m_padding.top, -m_padding.right, -m_padding.bottom, -m_padding.left);
|
||||
@@ -1007,7 +1007,7 @@ Rect UIWidget::getChildrenRect()
|
||||
childrenRect = childrenRect.united(marginRect);
|
||||
}
|
||||
|
||||
Rect myClippingRect = getClippingRect();
|
||||
Rect myClippingRect = getPaddingRect();
|
||||
if(!childrenRect.isValid())
|
||||
childrenRect = myClippingRect;
|
||||
else {
|
||||
|
@@ -137,7 +137,7 @@ public:
|
||||
bool isChildLocked(const UIWidgetPtr& child);
|
||||
bool hasChild(const UIWidgetPtr& child);
|
||||
int getChildIndex(const UIWidgetPtr& child);
|
||||
Rect getClippingRect();
|
||||
Rect getPaddingRect();
|
||||
Rect getMarginRect();
|
||||
Rect getChildrenRect();
|
||||
UIAnchorLayoutPtr getAnchoredLayout();
|
||||
@@ -243,7 +243,7 @@ public:
|
||||
bool isDestroyed() { return m_destroyed; }
|
||||
|
||||
bool hasChildren() { return m_children.size() > 0; }
|
||||
bool containsChildPoint(const Point& point) { return getClippingRect().contains(point); }
|
||||
bool containsChildPoint(const Point& point) { return getPaddingRect().contains(point); }
|
||||
bool containsPoint(const Point& point) { return m_rect.contains(point); }
|
||||
|
||||
std::string getId() { return m_id; }
|
||||
|
Reference in New Issue
Block a user