11use crate :: consts:: {
2- ARC_SWEEP_GIZMO_RADIUS , COLOR_OVERLAY_BLUE , COLOR_OVERLAY_BLUE_50 , COLOR_OVERLAY_GREEN , COLOR_OVERLAY_RED , COLOR_OVERLAY_WHITE , COLOR_OVERLAY_YELLOW , COLOR_OVERLAY_YELLOW_DULL ,
3- COMPASS_ROSE_ARROW_SIZE , COMPASS_ROSE_HOVER_RING_DIAMETER , COMPASS_ROSE_MAIN_RING_DIAMETER , COMPASS_ROSE_RING_INNER_DIAMETER , DOWEL_PIN_RADIUS , MANIPULATOR_GROUP_MARKER_SIZE ,
4- PIVOT_CROSSHAIR_LENGTH , PIVOT_CROSSHAIR_THICKNESS , PIVOT_DIAMETER , RESIZE_HANDLE_SIZE , SKEW_TRIANGLE_OFFSET , SKEW_TRIANGLE_SIZE ,
2+ ARC_SWEEP_GIZMO_RADIUS , COLOR_OVERLAY_BLACK , COLOR_OVERLAY_BLUE , COLOR_OVERLAY_BLUE_50 , COLOR_OVERLAY_GREEN , COLOR_OVERLAY_RED , COLOR_OVERLAY_WHITE , COLOR_OVERLAY_YELLOW ,
3+ COLOR_OVERLAY_YELLOW_DULL , COMPASS_ROSE_ARROW_SIZE , COMPASS_ROSE_HOVER_RING_DIAMETER , COMPASS_ROSE_MAIN_RING_DIAMETER , COMPASS_ROSE_RING_INNER_DIAMETER , DOWEL_PIN_RADIUS ,
4+ MANIPULATOR_GROUP_MARKER_SIZE , PIVOT_CROSSHAIR_LENGTH , PIVOT_CROSSHAIR_THICKNESS , PIVOT_DIAMETER , RESIZE_HANDLE_SIZE , SKEW_TRIANGLE_OFFSET , SKEW_TRIANGLE_SIZE ,
55} ;
66use crate :: messages:: portfolio:: document:: overlays:: utility_functions:: { GLOBAL_FONT_CACHE , GLOBAL_TEXT_CONTEXT } ;
77use crate :: messages:: portfolio:: document:: utility_types:: document_metadata:: LayerNodeIdentifier ;
@@ -273,6 +273,10 @@ impl OverlayContext {
273273 self . internal ( ) . manipulator_anchor ( position, selected, color) ;
274274 }
275275
276+ pub fn gradient_color_stop ( & mut self , position : DVec2 , selected : bool , color : & str ) {
277+ self . internal ( ) . gradient_color_stop ( position, selected, color) ;
278+ }
279+
276280 pub fn resize_handle ( & mut self , position : DVec2 , rotation : f64 ) {
277281 self . internal ( ) . resize_handle ( position, rotation) ;
278282 }
@@ -583,6 +587,29 @@ impl OverlayContextInternal {
583587 self . square ( position, None , Some ( color_fill) , Some ( COLOR_OVERLAY_BLUE ) ) ;
584588 }
585589
590+ fn gradient_color_stop ( & mut self , position : DVec2 , selected : bool , color : & str ) {
591+ let transform = self . get_transform ( ) ;
592+ let position = position. round ( ) - DVec2 :: splat ( 0.5 ) ;
593+
594+ let ( radius_offset, stroke_width) = if selected { ( 1. , 3. ) } else { ( 0. , 1. ) } ;
595+ let radius = MANIPULATOR_GROUP_MARKER_SIZE / 1.5 + 1. + radius_offset;
596+
597+ let mut draw_circle = |radius : f64 , width : Option < f64 > , color : & str | {
598+ let circle = kurbo:: Circle :: new ( ( position. x , position. y ) , radius) ;
599+ if let Some ( width) = width {
600+ self . scene . stroke ( & kurbo:: Stroke :: new ( width) , transform, Self :: parse_color ( color) , None , & circle) ;
601+ } else {
602+ self . scene . fill ( peniko:: Fill :: NonZero , transform, Self :: parse_color ( color) , None , & circle) ;
603+ }
604+ } ;
605+ // Fill
606+ draw_circle ( radius, None , color) ;
607+ // Stroke (inner)
608+ draw_circle ( radius + stroke_width / 2. , Some ( 1. ) , COLOR_OVERLAY_BLACK ) ;
609+ // Stroke (outer)
610+ draw_circle ( radius, Some ( stroke_width) , COLOR_OVERLAY_WHITE ) ;
611+ }
612+
586613 fn resize_handle ( & mut self , position : DVec2 , rotation : f64 ) {
587614 let quad = DAffine2 :: from_angle_translation ( rotation, position) * Quad :: from_box ( [ DVec2 :: splat ( -RESIZE_HANDLE_SIZE / 2. ) , DVec2 :: splat ( RESIZE_HANDLE_SIZE / 2. ) ] ) ;
588615 self . quad ( quad, None , Some ( COLOR_OVERLAY_WHITE ) ) ;
@@ -832,7 +859,7 @@ impl OverlayContextInternal {
832859 path. move_to ( kurbo:: Point :: new ( x, y) ) ;
833860 path. line_to ( kurbo:: Point :: new ( start1_x, start1_y) ) ;
834861
835- let arc1 = kurbo:: Arc :: new ( ( x, y) , ( DOWEL_PIN_RADIUS , DOWEL_PIN_RADIUS ) , start1, FRAC_PI_2 , 0.0 ) ;
862+ let arc1 = kurbo:: Arc :: new ( ( x, y) , ( DOWEL_PIN_RADIUS , DOWEL_PIN_RADIUS ) , start1, FRAC_PI_2 , 0. ) ;
836863 arc1. to_cubic_beziers ( 0.1 , |p1, p2, p| {
837864 path. curve_to ( p1, p2, p) ;
838865 } ) ;
@@ -844,7 +871,7 @@ impl OverlayContextInternal {
844871 path. move_to ( kurbo:: Point :: new ( x, y) ) ;
845872 path. line_to ( kurbo:: Point :: new ( start2_x, start2_y) ) ;
846873
847- let arc2 = kurbo:: Arc :: new ( ( x, y) , ( DOWEL_PIN_RADIUS , DOWEL_PIN_RADIUS ) , start2, FRAC_PI_2 , 0.0 ) ;
874+ let arc2 = kurbo:: Arc :: new ( ( x, y) , ( DOWEL_PIN_RADIUS , DOWEL_PIN_RADIUS ) , start2, FRAC_PI_2 , 0. ) ;
848875 arc2. to_cubic_beziers ( 0.1 , |p1, p2, p| {
849876 path. curve_to ( p1, p2, p) ;
850877 } ) ;
@@ -891,15 +918,15 @@ impl OverlayContextInternal {
891918 let mut path = BezPath :: new ( ) ;
892919 self . bezier_to_path ( bezier, transform, true , & mut path) ;
893920
894- self . scene . stroke ( & kurbo:: Stroke :: new ( 4.0 ) , vello_transform, Self :: parse_color ( COLOR_OVERLAY_BLUE ) , None , & path) ;
921+ self . scene . stroke ( & kurbo:: Stroke :: new ( 4. ) , vello_transform, Self :: parse_color ( COLOR_OVERLAY_BLUE ) , None , & path) ;
895922 }
896923
897924 fn outline_overlay_bezier ( & mut self , bezier : PathSeg , transform : DAffine2 ) {
898925 let vello_transform = self . get_transform ( ) ;
899926 let mut path = BezPath :: new ( ) ;
900927 self . bezier_to_path ( bezier, transform, true , & mut path) ;
901928
902- self . scene . stroke ( & kurbo:: Stroke :: new ( 4.0 ) , vello_transform, Self :: parse_color ( COLOR_OVERLAY_BLUE_50 ) , None , & path) ;
929+ self . scene . stroke ( & kurbo:: Stroke :: new ( 4. ) , vello_transform, Self :: parse_color ( COLOR_OVERLAY_BLUE_50 ) , None , & path) ;
903930 }
904931
905932 fn bezier_to_path ( & self , bezier : PathSeg , transform : DAffine2 , move_to : bool , path : & mut BezPath ) {
@@ -1035,16 +1062,16 @@ impl OverlayContextInternal {
10351062
10361063 fn text ( & mut self , text : & str , font_color : & str , background_color : Option < & str > , transform : DAffine2 , padding : f64 , pivot : [ Pivot ; 2 ] ) {
10371064 // Use the proper text-to-path system for accurate text rendering
1038- const FONT_SIZE : f64 = 12.0 ;
1065+ const FONT_SIZE : f64 = 12. ;
10391066
10401067 // Create typesetting configuration
10411068 let typesetting = TypesettingConfig {
10421069 font_size : FONT_SIZE ,
10431070 line_height_ratio : 1.2 ,
1044- character_spacing : 0.0 ,
1071+ character_spacing : 0. ,
10451072 max_width : None ,
10461073 max_height : None ,
1047- tilt : 0.0 ,
1074+ tilt : 0. ,
10481075 align : TextAlign :: Left , // We'll handle alignment manually via pivot
10491076 } ;
10501077
@@ -1059,7 +1086,7 @@ impl OverlayContextInternal {
10591086 let text_width = text_size. x ;
10601087 let text_height = text_size. y ;
10611088 // Create a rect from the size (assuming text starts at origin)
1062- let text_bounds = kurbo:: Rect :: new ( 0.0 , 0.0 , text_width, text_height) ;
1089+ let text_bounds = kurbo:: Rect :: new ( 0. , 0. , text_width, text_height) ;
10631090
10641091 // Convert text to vector paths for rendering
10651092 let text_table = text_context. to_path ( text, & font, & GLOBAL_FONT_CACHE , typesetting, false ) ;
@@ -1068,7 +1095,7 @@ impl OverlayContextInternal {
10681095 let mut position = DVec2 :: ZERO ;
10691096 match pivot[ 0 ] {
10701097 Pivot :: Start => position. x = padding,
1071- Pivot :: Middle => position. x = -text_width / 2.0 ,
1098+ Pivot :: Middle => position. x = -text_width / 2. ,
10721099 Pivot :: End => position. x = -padding - text_width,
10731100 }
10741101 match pivot[ 1 ] {
0 commit comments