diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2022-09-18 10:48:08 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2022-09-18 10:48:08 +0200 |
commit | 6e8638683e134b62eb3b380f4687c2762f782896 (patch) | |
tree | cc2d1817da46865142c70189ff8ee77f286518ab /scene/gui | |
parent | 24115beb3c69e648b1d48f969785b9b0729e1be8 (diff) | |
parent | 464c374372af651c181089725c1ff8db801ddcef (diff) |
Merge pull request #66012 from Rindbee/fix-TabContainer-minimum_size
Fix minimum size calculation for `TabContainer`
Diffstat (limited to 'scene/gui')
-rw-r--r-- | scene/gui/tab_container.cpp | 11 |
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; |