@@ -16,7 +16,7 @@ use ui_events::{
1616} ;
1717use vello:: {
1818 Scene ,
19- kurbo:: { Affine , Line , Stroke } ,
19+ kurbo:: { Affine , Line , Rect , Stroke } ,
2020 peniko:: color:: palette,
2121 peniko:: { Brush , Fill } ,
2222} ;
@@ -148,7 +148,7 @@ impl Editor {
148148 pub fn cursor_blink ( & mut self ) {
149149 self . cursor_visible = self . start_time . is_some_and ( |start_time| {
150150 let elapsed = Instant :: now ( ) . duration_since ( start_time) ;
151- ( elapsed. as_millis ( ) / self . blink_period . as_millis ( ) ) % 2 == 0
151+ ( elapsed. as_millis ( ) / self . blink_period . as_millis ( ) ) . is_multiple_of ( 2 )
152152 } ) ;
153153 }
154154
@@ -346,10 +346,10 @@ impl Editor {
346346 }
347347
348348 pub fn handle_accesskit_action_request ( & mut self , req : & accesskit:: ActionRequest ) {
349- if req. action == accesskit:: Action :: SetTextSelection {
350- if let Some ( accesskit:: ActionData :: SetTextSelection ( selection) ) = & req. data {
351- self . driver ( ) . select_from_accesskit ( selection ) ;
352- }
349+ if req. action == accesskit:: Action :: SetTextSelection
350+ && let Some ( accesskit:: ActionData :: SetTextSelection ( selection) ) = & req. data
351+ {
352+ self . driver ( ) . select_from_accesskit ( selection ) ;
353353 }
354354 }
355355
@@ -363,25 +363,26 @@ impl Editor {
363363 /// Returns drawn `Generation`.
364364 pub fn draw ( & mut self , scene : & mut Scene ) -> Generation {
365365 let transform = Affine :: translate ( ( INSET as f64 , INSET as f64 ) ) ;
366- self . editor . selection_geometry_with ( |rect, _| {
367- scene. fill (
368- Fill :: NonZero ,
369- transform,
370- palette:: css:: STEEL_BLUE ,
371- None ,
372- & rect,
373- ) ;
374- } ) ;
375- if self . cursor_visible {
376- if let Some ( cursor) = self . editor . cursor_geometry ( 5.0 ) {
366+ self . editor
367+ . selection_geometry_with ( |parley:: BoundingBox { x0, x1, y0, y1 } , _| {
377368 scene. fill (
378369 Fill :: NonZero ,
379370 transform,
380- palette:: css:: CADET_BLUE ,
371+ palette:: css:: STEEL_BLUE ,
381372 None ,
382- & cursor ,
373+ & Rect { x0 , x1 , y0 , y1 } ,
383374 ) ;
384- }
375+ } ) ;
376+ if self . cursor_visible
377+ && let Some ( parley:: BoundingBox { x0, x1, y0, y1 } ) = self . editor . cursor_geometry ( 5.0 )
378+ {
379+ scene. fill (
380+ Fill :: NonZero ,
381+ transform,
382+ palette:: css:: CADET_BLUE ,
383+ None ,
384+ & Rect { x0, x1, y0, y1 } ,
385+ ) ;
385386 }
386387 let layout = self . editor . layout ( & mut self . font_cx , & mut self . layout_cx ) ;
387388 for line in layout. lines ( ) {
0 commit comments