@@ -583,6 +583,7 @@ impl<'open> Window<'open> {
583
583
outer_rect,
584
584
frame_stroke,
585
585
window_frame. rounding ,
586
+ resize_interaction,
586
587
) ;
587
588
588
589
// END FRAME --------------------------------
@@ -651,29 +652,30 @@ fn paint_resize_corner(
651
652
outer_rect : Rect ,
652
653
stroke : impl Into < Stroke > ,
653
654
rounding : impl Into < Rounding > ,
655
+ i : ResizeInteraction ,
654
656
) {
655
- let stroke = stroke. into ( ) ;
657
+ let inactive_stroke = stroke. into ( ) ;
656
658
let rounding = rounding. into ( ) ;
657
- let ( corner, radius) = if possible. resize_right && possible. resize_bottom {
658
- ( Align2 :: RIGHT_BOTTOM , rounding. se )
659
+ let ( corner, radius, corner_response ) = if possible. resize_right && possible. resize_bottom {
660
+ ( Align2 :: RIGHT_BOTTOM , rounding. se , i . right & i . bottom )
659
661
} else if possible. resize_left && possible. resize_bottom {
660
- ( Align2 :: LEFT_BOTTOM , rounding. sw )
662
+ ( Align2 :: LEFT_BOTTOM , rounding. sw , i . left & i . bottom )
661
663
} else if possible. resize_left && possible. resize_top {
662
- ( Align2 :: LEFT_TOP , rounding. nw )
664
+ ( Align2 :: LEFT_TOP , rounding. nw , i . left & i . top )
663
665
} else if possible. resize_right && possible. resize_top {
664
- ( Align2 :: RIGHT_TOP , rounding. ne )
666
+ ( Align2 :: RIGHT_TOP , rounding. ne , i . right & i . top )
665
667
} else {
666
668
// We're not in two directions, but it is still nice to tell the user
667
669
// we're resizable by painting the resize corner in the expected place
668
670
// (i.e. for windows only resizable in one direction):
669
671
if possible. resize_right || possible. resize_bottom {
670
- ( Align2 :: RIGHT_BOTTOM , rounding. se )
672
+ ( Align2 :: RIGHT_BOTTOM , rounding. se , i . right & i . bottom )
671
673
} else if possible. resize_left || possible. resize_bottom {
672
- ( Align2 :: LEFT_BOTTOM , rounding. sw )
674
+ ( Align2 :: LEFT_BOTTOM , rounding. sw , i . left & i . bottom )
673
675
} else if possible. resize_left || possible. resize_top {
674
- ( Align2 :: LEFT_TOP , rounding. nw )
676
+ ( Align2 :: LEFT_TOP , rounding. nw , i . left & i . top )
675
677
} else if possible. resize_right || possible. resize_top {
676
- ( Align2 :: RIGHT_TOP , rounding. ne )
678
+ ( Align2 :: RIGHT_TOP , rounding. ne , i . right & i . top )
677
679
} else {
678
680
return ;
679
681
}
@@ -683,6 +685,14 @@ fn paint_resize_corner(
683
685
let offset =
684
686
( ( 2.0_f32 . sqrt ( ) * ( 1.0 + radius) - radius) * 45.0_f32 . to_radians ( ) . cos ( ) ) . max ( 2.0 ) ;
685
687
688
+ let stroke = if corner_response. drag {
689
+ ui. visuals ( ) . widgets . active . fg_stroke
690
+ } else if corner_response. hover {
691
+ ui. visuals ( ) . widgets . hovered . fg_stroke
692
+ } else {
693
+ inactive_stroke
694
+ } ;
695
+
686
696
let corner_size = Vec2 :: splat ( ui. visuals ( ) . resize_corner_size ) ;
687
697
let corner_rect = corner. align_size_within_rect ( corner_size, outer_rect) ;
688
698
let corner_rect = corner_rect. translate ( -offset * corner. to_sign ( ) ) ; // move away from corner
@@ -744,6 +754,17 @@ impl SideResponse {
744
754
}
745
755
}
746
756
757
+ impl std:: ops:: BitAnd for SideResponse {
758
+ type Output = Self ;
759
+
760
+ fn bitand ( self , rhs : Self ) -> Self :: Output {
761
+ Self {
762
+ hover : self . hover && rhs. hover ,
763
+ drag : self . drag && rhs. drag ,
764
+ }
765
+ }
766
+ }
767
+
747
768
impl std:: ops:: BitOrAssign for SideResponse {
748
769
fn bitor_assign ( & mut self , rhs : Self ) {
749
770
* self = Self {
@@ -927,41 +948,41 @@ fn resize_interaction(
927
948
if possible. resize_right || possible. resize_bottom {
928
949
let response = side_response ( corner_rect ( rect. right_bottom ( ) ) , id. with ( "right_bottom" ) ) ;
929
950
if possible. resize_right {
930
- right |= response;
951
+ right |= response;
931
952
}
932
953
if possible. resize_bottom {
933
- bottom |= response;
934
- }
954
+ bottom |= response;
955
+ }
935
956
}
936
957
937
958
if possible. resize_right || possible. resize_top {
938
959
let response = side_response ( corner_rect ( rect. right_top ( ) ) , id. with ( "right_top" ) ) ;
939
960
if possible. resize_right {
940
- right |= response;
961
+ right |= response;
941
962
}
942
963
if possible. resize_top {
943
- top |= response;
944
- }
964
+ top |= response;
965
+ }
945
966
}
946
967
947
968
if possible. resize_left || possible. resize_bottom {
948
969
let response = side_response ( corner_rect ( rect. left_bottom ( ) ) , id. with ( "left_bottom" ) ) ;
949
970
if possible. resize_left {
950
- left |= response;
971
+ left |= response;
951
972
}
952
973
if possible. resize_bottom {
953
- bottom |= response;
954
- }
974
+ bottom |= response;
975
+ }
955
976
}
956
977
957
978
if possible. resize_left || possible. resize_top {
958
979
let response = side_response ( corner_rect ( rect. left_top ( ) ) , id. with ( "left_top" ) ) ;
959
980
if possible. resize_left {
960
- left |= response;
981
+ left |= response;
961
982
}
962
983
if possible. resize_top {
963
- top |= response;
964
- }
984
+ top |= response;
985
+ }
965
986
}
966
987
967
988
let interaction = ResizeInteraction {
0 commit comments