Skip to content

Commit

Permalink
Merge pull request #79494 from timothyqiu/no-longer
Browse files Browse the repository at this point in the history
Update OptionButton min size when disabling Fit to Longest Item
  • Loading branch information
YuriSizov authored Jul 17, 2023
2 parents 3a21364 + 5384c1a commit 5954c58
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions scene/gui/option_button.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down

0 comments on commit 5954c58

Please sign in to comment.