Fix OptionButton PopupMenu not shrinking after item changes
Fixes #114786. Reset min_size before popup to prevent clamping to old size. Move shrink_width to constructor following PR #114760 style.
This commit is contained in:
parent
2ed91ed207
commit
72ed25ea24
1 changed files with 2 additions and 1 deletions
|
|
@ -547,7 +547,7 @@ void OptionButton::show_popup() {
|
|||
rect = xform.xform(rect);
|
||||
}
|
||||
rect.size.height = 0;
|
||||
popup->set_shrink_width(false);
|
||||
popup->set_min_size(Size2(0, 0));
|
||||
popup->popup(rect);
|
||||
}
|
||||
|
||||
|
|
@ -655,6 +655,7 @@ OptionButton::OptionButton(const String &p_text) :
|
|||
set_action_mode(ACTION_MODE_BUTTON_PRESS);
|
||||
|
||||
popup = memnew(PopupMenu);
|
||||
popup->set_shrink_width(false);
|
||||
popup->hide();
|
||||
add_child(popup, false, INTERNAL_MODE_FRONT);
|
||||
popup->connect("index_pressed", callable_mp(this, &OptionButton::_selected));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue