File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed
crates/egui/src/containers Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -79,12 +79,22 @@ pub fn show_tooltip_at_pointer<R>(
79
79
add_contents : impl FnOnce ( & mut Ui ) -> R ,
80
80
) -> Option < R > {
81
81
ctx. input ( |i| i. pointer . hover_pos ( ) ) . map ( |pointer_pos| {
82
- show_tooltip_at (
82
+ let allow_placing_below = true ;
83
+
84
+ // Add a small exclusion zone around the pointer to avoid tooltips
85
+ // covering what we're hovering over.
86
+ let mut exclusion_rect = Rect :: from_center_size ( pointer_pos, Vec2 :: splat ( 24.0 ) ) ;
87
+
88
+ // Keep the left edge of the tooltip in line with the cursor:
89
+ exclusion_rect. min . x = pointer_pos. x ;
90
+
91
+ show_tooltip_at_dyn (
83
92
ctx,
84
93
parent_layer,
85
94
widget_id,
86
- pointer_pos + vec2 ( 16.0 , 16.0 ) ,
87
- add_contents,
95
+ allow_placing_below,
96
+ & exclusion_rect,
97
+ Box :: new ( add_contents) ,
88
98
)
89
99
} )
90
100
}
You can’t perform that action at this time.
0 commit comments