Fix OptionButton PopupMenu not shrinking after item changes#114806
Conversation
|
Please turn off the copilot feature for contributing to Godot, it creates a lot of noise (and uses CI resources) and risks including bad suggestions that you then have to fix because it didn't understand how we write code and do things in the engine |
|
See also #114760. |
|
Understood, I've disabled the Copilot auto-review feature. |
|
@akien-mga This PR doesn't affect the bug I fixed, because it doesn't use an In my PR however, I moved |
ce46750 to
dfc945e
Compare
|
Agreed. Updated to follow @YeldhamDev's suggestion from #114760: Moved |
|
|
This is default, so not needed at all. |
Fixes godotengine#114786. Reset min_size before popup to prevent clamping to old size. Move shrink_width to constructor following PR godotengine#114760 style.
dfc945e to
72ed25e
Compare
|
That's right. Removed |
|
I believe the actual fix should be to remove |
Because, it should not shrink width to anything smaller than the size of the |
|
Currently it looks like sizing responsibilities are split between Window, PopupMenu, and individual widgets. If we're considering a full redesign for 4.7, we could introduce a |
|
Thanks! And congrats for your first merged Godot contribution 🎉 |
Fixes #114786.
Updates
OptionButton::show_popup()to correctly handlePopupMenuresizing when content changes from larger to smaller items.popup->set_min_size(Size2(0, 0))before opening. This is crucial becauseWindow::popup(rect)clamps the size to the currentmin_size. Without resetting it, the window refuses to shrink to the new smaller content size because it's still constrained by the previous items' minimum size.popup->set_shrink_height(true)to ensure the height is recalculated to fit the new content.Verified with the MRP from the issue. The PopupMenu now immediately shrinks to the correct size when switching from long items to short items.
Before_bug.mp4
After_bug.mp4