mirror of
https://github.com/emilk/egui.git
synced 2026-09-03 15:20:05 -04:00
Rerun sizing_pass when reopening popup (#8315)
* Closes <https://github.com/emilk/egui/issues/8115> * [x] I have followed the instructions in the PR template ## Summary - Recalculate a menu popup's cached `Area` size when it reopens. - Preserve cached sizing for continuously open menus and leave tooltips and general popups unchanged. - Add a headless regression test covering a wider item added while the menu is closed. ## Root cause `Area` keeps its cached size after a menu closes. When that menu reopened with wider content, the cached width constrained the new item and caused it to wrap instead of allowing the popup to grow. The fix requests the same invisible sizing pass used for a first-open `Area` whenever a menu was not open during the previous frame. ## User impact Menus now expand to fit newly added wider items after reopening. Existing wrapping, explicit-width, alignment, screen-constraining, and continuously open menu behavior remain unchanged. ## Validation - `cargo test -p egui_kittest --test menu` - `cargo check -p egui` - `cargo fmt --all -- --check`
This commit is contained in:
committed by
GitHub
parent
3fcadda5ba
commit
d28929ec72
@@ -571,6 +571,7 @@ impl<'a> Popup<'a> {
|
||||
.fixed_pos(anchor)
|
||||
.sense(sense)
|
||||
.layout(layout)
|
||||
.sizing_pass(!was_open_last_frame)
|
||||
.info(info.unwrap_or_else(|| {
|
||||
UiStackInfo::new(kind.into()).with_tag_value(
|
||||
MenuConfig::MENU_CONFIG_TAG,
|
||||
|
||||
Reference in New Issue
Block a user