Commit 7bfee6d 1 parent 2ba91f3 commit 7bfee6d Copy full SHA for 7bfee6d
File tree 3 files changed +14
-11
lines changed
3 files changed +14
-11
lines changed Original file line number Diff line number Diff line change @@ -886,8 +886,8 @@ impl PointerState {
886
886
887
887
/// How long has it been (in seconds) since the pointer was last moved?
888
888
#[ inline( always) ]
889
- pub fn time_since_last_movement ( & self ) -> f64 {
890
- self . time - self . last_move_time
889
+ pub fn time_since_last_movement ( & self ) -> f32 {
890
+ ( self . time - self . last_move_time ) as f32
891
891
}
892
892
893
893
/// Was any pointer button pressed (`!down -> down`) this frame?
Original file line number Diff line number Diff line change @@ -499,13 +499,16 @@ impl Response {
499
499
}
500
500
}
501
501
502
- if !self . is_tooltip_open ( )
503
- && self . ctx . input ( |i| i. pointer . time_since_last_movement ( ) )
504
- < self . ctx . style ( ) . interaction . tooltip_delay
505
- {
506
- // Keep waiting until the mouse has been still for a while
507
- self . ctx . request_repaint ( ) ;
508
- return false ;
502
+ if !self . is_tooltip_open ( ) {
503
+ let time_til_tooltip = self . ctx . style ( ) . interaction . tooltip_delay
504
+ - self . ctx . input ( |i| i. pointer . time_since_last_movement ( ) ) ;
505
+
506
+ if 0.0 < time_til_tooltip {
507
+ // Wait until the mouse has been still for a while
508
+ self . ctx
509
+ . request_repaint_after ( std:: time:: Duration :: from_secs_f32 ( time_til_tooltip) ) ;
510
+ return false ;
511
+ }
509
512
}
510
513
511
514
// We don't want tooltips of things while we are dragging them,
Original file line number Diff line number Diff line change @@ -719,7 +719,7 @@ pub struct Interaction {
719
719
pub show_tooltips_only_when_still : bool ,
720
720
721
721
/// Delay in seconds before showing tooltips after the mouse stops moving
722
- pub tooltip_delay : f64 ,
722
+ pub tooltip_delay : f32 ,
723
723
724
724
/// Can you select the text on a [`crate::Label`] by default?
725
725
pub selectable_labels : bool ,
@@ -1128,7 +1128,7 @@ impl Default for Interaction {
1128
1128
resize_grab_radius_side : 5.0 ,
1129
1129
resize_grab_radius_corner : 10.0 ,
1130
1130
show_tooltips_only_when_still : true ,
1131
- tooltip_delay : 0.0 ,
1131
+ tooltip_delay : 0.3 ,
1132
1132
selectable_labels : true ,
1133
1133
multi_widget_text_select : true ,
1134
1134
}
You can’t perform that action at this time.
0 commit comments