Skip to content

Commit d17aa52

Browse files
committed
Nicer approach thanks to Lucs
1 parent 9f80079 commit d17aa52

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

crates/egui/src/containers/window.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -576,17 +576,14 @@ impl Window<'_> {
576576
let (content_inner, content_response) = collapsing
577577
.show_body_unindented(&mut frame.content_ui, |ui| {
578578
resize.show(ui, |ui| {
579-
let add_contents_with_margin = |ui: &mut Ui| {
579+
let margin = ui.spacing().window_margin;
580+
if scroll.is_any_scroll_enabled() {
581+
scroll.content_margin(margin).show(ui, add_contents).inner
582+
} else {
580583
crate::Frame::NONE
581-
.inner_margin(ui.spacing().window_margin)
584+
.inner_margin(margin)
582585
.show(ui, add_contents)
583586
.inner
584-
};
585-
586-
if scroll.is_any_scroll_enabled() {
587-
scroll.show(ui, add_contents_with_margin).inner
588-
} else {
589-
add_contents_with_margin(ui)
590587
}
591588
})
592589
})

0 commit comments

Comments
 (0)