summaryrefslogtreecommitdiff
path: root/scene/gui
diff options
context:
space:
mode:
authorRindbee <idleman@yeah.net>2022-09-18 06:32:57 +0800
committerRindbee <idleman@yeah.net>2022-09-18 06:59:48 +0800
commit464c374372af651c181089725c1ff8db801ddcef (patch)
treedd310141d941f80855e1061c21add6d8ebcfe9c1 /scene/gui
parent57bdddce02370af3d13e6edc583afdc17264147d (diff)
Fix minimum size calculation for TabContainer
Diffstat (limited to 'scene/gui')
-rw-r--r--scene/gui/tab_container.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/scene/gui/tab_container.cpp b/scene/gui/tab_container.cpp
index f45d132a66..1df698a108 100644
--- a/scene/gui/tab_container.cpp
+++ b/scene/gui/tab_container.cpp
@@ -838,7 +838,7 @@ Size2 TabContainer::get_minimum_size() const {
}
Vector<Control *> controls = _get_tab_controls();
- int max_control_height = 0;
+ Size2 largest_child_min_size;
for (int i = 0; i < controls.size(); i++) {
Control *c = controls[i];
@@ -847,13 +847,14 @@ Size2 TabContainer::get_minimum_size() const {
}
Size2 cms = c->get_combined_minimum_size();
- ms.x = MAX(ms.x, cms.x);
- max_control_height = MAX(max_control_height, cms.y);
+ largest_child_min_size.x = MAX(largest_child_min_size.x, cms.x);
+ largest_child_min_size.y = MAX(largest_child_min_size.y, cms.y);
}
- ms.y += max_control_height;
+ ms.y += largest_child_min_size.y;
Size2 panel_ms = theme_cache.panel_style->get_minimum_size();
- ms.x = MAX(ms.x, panel_ms.x);
+
+ ms.x = MAX(ms.x, largest_child_min_size.x + panel_ms.x);
ms.y += panel_ms.y;
return ms;