diff --git a/egui/src/input.rs b/egui/src/input.rs index b72e99e8..9180c672 100644 --- a/egui/src/input.rs +++ b/egui/src/input.rs @@ -506,6 +506,10 @@ impl MouseInput { pos_history: self.pos_history, } } + + pub fn is_moving(&self) -> bool { + self.velocity != Vec2::zero() + } } impl RawInput { diff --git a/egui/src/widgets/text_edit.rs b/egui/src/widgets/text_edit.rs index 79996211..83629452 100644 --- a/egui/src/widgets/text_edit.rs +++ b/egui/src/widgets/text_edit.rs @@ -324,7 +324,7 @@ impl<'t> TextEdit<'t> { let cursor_at_mouse = galley.cursor_from_pos(mouse_pos - response.rect.min); - if response.hovered { + if response.hovered && ui.input().mouse.is_moving() { // preview: paint_cursor_end(ui, response.rect.min, &galley, &cursor_at_mouse); }