Update OptionButton min size when disabling Fit to Longest Item

This commit is contained in:
Haoyu Qiu 2023-07-15 11:10:23 +08:00
parent a7583881af
commit 5384c1a579
1 changed files with 5 additions and 7 deletions

View File

@ -445,14 +445,12 @@ void OptionButton::_select_int(int p_which) {
void OptionButton::_refresh_size_cache() { void OptionButton::_refresh_size_cache() {
cache_refresh_pending = false; cache_refresh_pending = false;
if (!fit_to_longest_item) { if (fit_to_longest_item) {
return;
}
_cached_size = Vector2(); _cached_size = Vector2();
for (int i = 0; i < get_item_count(); i++) { 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))); _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(); update_minimum_size();
} }