summaryrefslogtreecommitdiff
path: root/scene/gui
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2022-08-22 17:33:27 +0200
committerGitHub <noreply@github.com>2022-08-22 17:33:27 +0200
commitdabc9823934ca13ad02cd13fcb544aaab955da25 (patch)
tree2997df6ae22e6951afa3dd45ae847e6a734e1a1c /scene/gui
parent944bfc6d003ab247ded5520708abeb08021e6f91 (diff)
parent8f2083e6c0f4b32776a48d4975b1224cbc385ab4 (diff)
Merge pull request #64618 from bruvzg/fix_menu_min_size
Diffstat (limited to 'scene/gui')
-rw-r--r--scene/gui/menu_bar.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/scene/gui/menu_bar.cpp b/scene/gui/menu_bar.cpp
index ebe833c6e0..f450222130 100644
--- a/scene/gui/menu_bar.cpp
+++ b/scene/gui/menu_bar.cpp
@@ -749,7 +749,6 @@ Size2 MenuBar::get_minimum_size() const {
}
Ref<StyleBox> style = get_theme_stylebox(SNAME("normal"));
- int hsep = get_theme_constant(SNAME("h_separation"));
Vector2 size;
for (int i = 0; i < menu_cache.size(); i++) {
@@ -758,7 +757,10 @@ Size2 MenuBar::get_minimum_size() const {
}
Size2 sz = menu_cache[i].text_buf->get_size() + style->get_minimum_size();
size.y = MAX(size.y, sz.y);
- size.x += sz.x + hsep;
+ size.x += sz.x;
+ }
+ if (menu_cache.size() > 1) {
+ size.x += get_theme_constant(SNAME("h_separation")) * (menu_cache.size() - 1);
}
return size;
}