summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYuri Sizov <11782833+YuriSizov@users.noreply.github.com>2023-07-17 19:12:03 +0200
committerGitHub <noreply@github.com>2023-07-17 19:12:03 +0200
commit5954c58ee1912d6ddceb165edfc27cc6084a4fa2 (patch)
treeecb802ac191d5cb2bd329576e7cb3ce48be3bb3b
parent3a213643c9b4025421544edff4a4779425cbf034 (diff)
parent5384c1a579bfc0073c2bfee0e02d0987a160a2c3 (diff)
downloadredot-engine-5954c58ee1912d6ddceb165edfc27cc6084a4fa2.tar.gz
Merge pull request #79494 from timothyqiu/no-longer
Update OptionButton min size when disabling Fit to Longest Item
-rw-r--r--scene/gui/option_button.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/scene/gui/option_button.cpp b/scene/gui/option_button.cpp
index 71d64c8bff..8138a66f64 100644
--- a/scene/gui/option_button.cpp
+++ b/scene/gui/option_button.cpp
@@ -445,13 +445,11 @@ void OptionButton::_select_int(int p_which) {
void OptionButton::_refresh_size_cache() {
cache_refresh_pending = false;
- if (!fit_to_longest_item) {
- return;
- }
-
- _cached_size = Vector2();
- for (int i = 0; i < get_item_count(); i++) {
- _cached_size = _cached_size.max(get_minimum_size_for_text_and_icon(popup->get_item_xl_text(i), get_item_icon(i)));
+ if (fit_to_longest_item) {
+ _cached_size = Vector2();
+ for (int i = 0; i < get_item_count(); i++) {
+ _cached_size = _cached_size.max(get_minimum_size_for_text_and_icon(popup->get_item_xl_text(i), get_item_icon(i)));
+ }
}
update_minimum_size();
}