3
3
use std:: sync:: Arc ;
4
4
5
5
use emath:: GuiRounding as _;
6
- use epaint:: { RectShape , Roundingf } ;
6
+ use epaint:: { CornerRadiusF32 , RectShape } ;
7
7
8
8
use crate :: collapsing_header:: CollapsingState ;
9
9
use crate :: * ;
@@ -485,8 +485,8 @@ impl Window<'_> {
485
485
. at_least ( style. spacing . interact_size . y ) ;
486
486
let title_bar_inner_height = title_bar_inner_height + window_frame. inner_margin . sum ( ) . y ;
487
487
let half_height = ( title_bar_inner_height / 2.0 ) . round ( ) as _ ;
488
- window_frame. rounding . ne = window_frame. rounding . ne . clamp ( 0 , half_height) ;
489
- window_frame. rounding . nw = window_frame. rounding . nw . clamp ( 0 , half_height) ;
488
+ window_frame. corner_radius . ne = window_frame. corner_radius . ne . clamp ( 0 , half_height) ;
489
+ window_frame. corner_radius . nw = window_frame. corner_radius . nw . clamp ( 0 , half_height) ;
490
490
491
491
let title_content_spacing = if is_collapsed {
492
492
0.0
@@ -612,7 +612,7 @@ impl Window<'_> {
612
612
613
613
if on_top && area_content_ui. visuals ( ) . window_highlight_topmost {
614
614
let mut round =
615
- window_frame. rounding - window_frame. stroke . width . round ( ) as u8 ;
615
+ window_frame. corner_radius - window_frame. stroke . width . round ( ) as u8 ;
616
616
617
617
if !is_collapsed {
618
618
round. se = 0 ;
@@ -667,28 +667,28 @@ fn paint_resize_corner(
667
667
window_frame : & Frame ,
668
668
i : ResizeInteraction ,
669
669
) {
670
- let rounding = window_frame. rounding ;
670
+ let cr = window_frame. corner_radius ;
671
671
672
672
let ( corner, radius, corner_response) = if possible. resize_right && possible. resize_bottom {
673
- ( Align2 :: RIGHT_BOTTOM , rounding . se , i. right & i. bottom )
673
+ ( Align2 :: RIGHT_BOTTOM , cr . se , i. right & i. bottom )
674
674
} else if possible. resize_left && possible. resize_bottom {
675
- ( Align2 :: LEFT_BOTTOM , rounding . sw , i. left & i. bottom )
675
+ ( Align2 :: LEFT_BOTTOM , cr . sw , i. left & i. bottom )
676
676
} else if possible. resize_left && possible. resize_top {
677
- ( Align2 :: LEFT_TOP , rounding . nw , i. left & i. top )
677
+ ( Align2 :: LEFT_TOP , cr . nw , i. left & i. top )
678
678
} else if possible. resize_right && possible. resize_top {
679
- ( Align2 :: RIGHT_TOP , rounding . ne , i. right & i. top )
679
+ ( Align2 :: RIGHT_TOP , cr . ne , i. right & i. top )
680
680
} else {
681
681
// We're not in two directions, but it is still nice to tell the user
682
682
// we're resizable by painting the resize corner in the expected place
683
683
// (i.e. for windows only resizable in one direction):
684
684
if possible. resize_right || possible. resize_bottom {
685
- ( Align2 :: RIGHT_BOTTOM , rounding . se , i. right & i. bottom )
685
+ ( Align2 :: RIGHT_BOTTOM , cr . se , i. right & i. bottom )
686
686
} else if possible. resize_left || possible. resize_bottom {
687
- ( Align2 :: LEFT_BOTTOM , rounding . sw , i. left & i. bottom )
687
+ ( Align2 :: LEFT_BOTTOM , cr . sw , i. left & i. bottom )
688
688
} else if possible. resize_left || possible. resize_top {
689
- ( Align2 :: LEFT_TOP , rounding . nw , i. left & i. top )
689
+ ( Align2 :: LEFT_TOP , cr . nw , i. left & i. top )
690
690
} else if possible. resize_right || possible. resize_top {
691
- ( Align2 :: RIGHT_TOP , rounding . ne , i. right & i. top )
691
+ ( Align2 :: RIGHT_TOP , cr . ne , i. right & i. top )
692
692
} else {
693
693
return ;
694
694
}
@@ -1054,7 +1054,7 @@ fn paint_frame_interaction(ui: &Ui, rect: Rect, interaction: ResizeInteraction)
1054
1054
bottom = interaction. bottom . hover ;
1055
1055
}
1056
1056
1057
- let rounding = Roundingf :: from ( ui. visuals ( ) . window_rounding ) ;
1057
+ let cr = CornerRadiusF32 :: from ( ui. visuals ( ) . window_corner_radius ) ;
1058
1058
1059
1059
// Put the rect in the center of the fixed window stroke:
1060
1060
let rect = rect. shrink ( interaction. window_frame . stroke . width / 2.0 ) ;
@@ -1072,56 +1072,36 @@ fn paint_frame_interaction(ui: &Ui, rect: Rect, interaction: ResizeInteraction)
1072
1072
let mut points = Vec :: new ( ) ;
1073
1073
1074
1074
if right && !bottom && !top {
1075
- points. push ( pos2 ( max. x , min. y + rounding . ne ) ) ;
1076
- points. push ( pos2 ( max. x , max. y - rounding . se ) ) ;
1075
+ points. push ( pos2 ( max. x , min. y + cr . ne ) ) ;
1076
+ points. push ( pos2 ( max. x , max. y - cr . se ) ) ;
1077
1077
}
1078
1078
if right && bottom {
1079
- points. push ( pos2 ( max. x , min. y + rounding. ne ) ) ;
1080
- points. push ( pos2 ( max. x , max. y - rounding. se ) ) ;
1081
- add_circle_quadrant (
1082
- & mut points,
1083
- pos2 ( max. x - rounding. se , max. y - rounding. se ) ,
1084
- rounding. se ,
1085
- 0.0 ,
1086
- ) ;
1079
+ points. push ( pos2 ( max. x , min. y + cr. ne ) ) ;
1080
+ points. push ( pos2 ( max. x , max. y - cr. se ) ) ;
1081
+ add_circle_quadrant ( & mut points, pos2 ( max. x - cr. se , max. y - cr. se ) , cr. se , 0.0 ) ;
1087
1082
}
1088
1083
if bottom {
1089
- points. push ( pos2 ( max. x - rounding . se , max. y ) ) ;
1090
- points. push ( pos2 ( min. x + rounding . sw , max. y ) ) ;
1084
+ points. push ( pos2 ( max. x - cr . se , max. y ) ) ;
1085
+ points. push ( pos2 ( min. x + cr . sw , max. y ) ) ;
1091
1086
}
1092
1087
if left && bottom {
1093
- add_circle_quadrant (
1094
- & mut points,
1095
- pos2 ( min. x + rounding. sw , max. y - rounding. sw ) ,
1096
- rounding. sw ,
1097
- 1.0 ,
1098
- ) ;
1088
+ add_circle_quadrant ( & mut points, pos2 ( min. x + cr. sw , max. y - cr. sw ) , cr. sw , 1.0 ) ;
1099
1089
}
1100
1090
if left {
1101
- points. push ( pos2 ( min. x , max. y - rounding . sw ) ) ;
1102
- points. push ( pos2 ( min. x , min. y + rounding . nw ) ) ;
1091
+ points. push ( pos2 ( min. x , max. y - cr . sw ) ) ;
1092
+ points. push ( pos2 ( min. x , min. y + cr . nw ) ) ;
1103
1093
}
1104
1094
if left && top {
1105
- add_circle_quadrant (
1106
- & mut points,
1107
- pos2 ( min. x + rounding. nw , min. y + rounding. nw ) ,
1108
- rounding. nw ,
1109
- 2.0 ,
1110
- ) ;
1095
+ add_circle_quadrant ( & mut points, pos2 ( min. x + cr. nw , min. y + cr. nw ) , cr. nw , 2.0 ) ;
1111
1096
}
1112
1097
if top {
1113
- points. push ( pos2 ( min. x + rounding . nw , min. y ) ) ;
1114
- points. push ( pos2 ( max. x - rounding . ne , min. y ) ) ;
1098
+ points. push ( pos2 ( min. x + cr . nw , min. y ) ) ;
1099
+ points. push ( pos2 ( max. x - cr . ne , min. y ) ) ;
1115
1100
}
1116
1101
if right && top {
1117
- add_circle_quadrant (
1118
- & mut points,
1119
- pos2 ( max. x - rounding. ne , min. y + rounding. ne ) ,
1120
- rounding. ne ,
1121
- 3.0 ,
1122
- ) ;
1123
- points. push ( pos2 ( max. x , min. y + rounding. ne ) ) ;
1124
- points. push ( pos2 ( max. x , max. y - rounding. se ) ) ;
1102
+ add_circle_quadrant ( & mut points, pos2 ( max. x - cr. ne , min. y + cr. ne ) , cr. ne , 3.0 ) ;
1103
+ points. push ( pos2 ( max. x , min. y + cr. ne ) ) ;
1104
+ points. push ( pos2 ( max. x , max. y - cr. se ) ) ;
1125
1105
}
1126
1106
1127
1107
ui. painter ( ) . add ( Shape :: line ( points, stroke) ) ;
0 commit comments