@@ -12,11 +12,11 @@ use parley::{
1212use std:: time:: { Duration , Instant } ;
1313use ui_events:: {
1414 keyboard:: { Code , Key , KeyState , KeyboardEvent , NamedKey } ,
15- pointer:: { PointerButton , PointerEvent , PointerState , PointerUpdate } ,
15+ pointer:: { PointerButton , PointerButtonEvent , PointerEvent , PointerState , PointerUpdate } ,
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
@@ -310,7 +310,7 @@ impl Editor {
310310 pub fn handle_pointer_event ( & mut self , ev : PointerEvent ) -> bool {
311311 let mut drv = self . editor . driver ( & mut self . font_cx , & mut self . layout_cx ) ;
312312 match ev {
313- PointerEvent :: Down {
313+ PointerEvent :: Down ( PointerButtonEvent {
314314 button : None | Some ( PointerButton :: Primary ) ,
315315 state :
316316 PointerState {
@@ -320,7 +320,7 @@ impl Editor {
320320 ..
321321 } ,
322322 ..
323- } => match count {
323+ } ) => match count {
324324 2 => drv. select_word_at_point ( position. x as f32 - INSET , position. y as f32 - INSET ) ,
325325 3 => drv. select_line_at_point ( position. x as f32 - INSET , position. y as f32 - INSET ) ,
326326 1 if modifiers. shift ( ) => drv. extend_selection_to_point (
@@ -346,11 +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 {
349+ if req. action == accesskit:: Action :: SetTextSelection
350+ && let Some ( accesskit:: ActionData :: SetTextSelection ( selection) ) = & req. data {
351351 self . driver ( ) . select_from_accesskit ( selection) ;
352352 }
353- }
354353 }
355354
356355 /// Return the current `Generation` of the layout.
@@ -363,26 +362,26 @@ impl Editor {
363362 /// Returns drawn `Generation`.
364363 pub fn draw ( & mut self , scene : & mut Scene ) -> Generation {
365364 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 ) {
365+ self . editor
366+ . selection_geometry_with ( |parley:: BoundingBox { x0, x1, y0, y1 } , _| {
367+ scene. fill (
368+ Fill :: NonZero ,
369+ transform,
370+ palette:: css:: STEEL_BLUE ,
371+ None ,
372+ & Rect { x0, x1, y0, y1 } ,
373+ ) ;
374+ } ) ;
375+ if self . cursor_visible
376+ && let Some ( parley:: BoundingBox { x0, x1, y0, y1 } ) = self . editor . cursor_geometry ( 5.0 ) {
377377 scene. fill (
378378 Fill :: NonZero ,
379379 transform,
380380 palette:: css:: CADET_BLUE ,
381381 None ,
382- & cursor ,
382+ & Rect { x0 , x1 , y0 , y1 } ,
383383 ) ;
384384 }
385- }
386385 let layout = self . editor . layout ( & mut self . font_cx , & mut self . layout_cx ) ;
387386 for line in layout. lines ( ) {
388387 for item in line. items ( ) {
0 commit comments