@@ -62,7 +62,7 @@ impl<'open> Window<'open> {
6262 . with_stroke ( false )
6363 . min_size ( [ 96.0 , 32.0 ] )
6464 . default_size ( [ 340.0 , 420.0 ] ) , // Default inner size of a window
65- scroll : ScrollArea :: neither ( ) . auto_shrink ( false ) ,
65+ scroll : ScrollArea :: neither ( ) . auto_shrink ( false ) . content_margin ( 0.0 ) ,
6666 collapsible : true ,
6767 default_open : true ,
6868 with_title_bar : true ,
@@ -509,12 +509,15 @@ impl Window<'_> {
509509
510510 area. with_widget_info ( || WidgetInfo :: labeled ( WidgetType :: Window , true , title. text ( ) ) ) ;
511511
512+ let window_margin = style. spacing . window_margin ;
513+
512514 // Calculate roughly how much larger the full window inner size is compared to the content rect
513515 let ( title_bar_height_with_margin, title_content_spacing) = if with_title_bar {
514516 let title_bar_inner_height = ctx
515517 . fonts_mut ( |fonts| title. font_height ( fonts, & style) )
516518 . at_least ( style. spacing . interact_size . y ) ;
517- let title_bar_inner_height = title_bar_inner_height + window_frame. inner_margin . sum ( ) . y ;
519+ let title_bar_inner_height =
520+ title_bar_inner_height + window_frame. inner_margin . sum ( ) . y + window_margin. sum ( ) . y ;
518521 let half_height = ( title_bar_inner_height / 2.0 ) . round ( ) as _ ;
519522 window_frame. corner_radius . ne = window_frame. corner_radius . ne . clamp ( 0 , half_height) ;
520523 window_frame. corner_radius . nw = window_frame. corner_radius . nw . clamp ( 0 , half_height) ;
@@ -613,9 +616,15 @@ impl Window<'_> {
613616 . show_body_unindented ( & mut frame. content_ui , |ui| {
614617 resize. show ( ui, |ui| {
615618 if scroll. is_any_scroll_enabled ( ) {
616- scroll. show ( ui, add_contents) . inner
619+ scroll
620+ . content_margin ( window_margin)
621+ . show ( ui, add_contents)
622+ . inner
617623 } else {
618- add_contents ( ui)
624+ crate :: Frame :: NONE
625+ . inner_margin ( window_margin)
626+ . show ( ui, add_contents)
627+ . inner
619628 }
620629 } )
621630 } )
0 commit comments