TextEdit: only show cursor preview when moving mouse

This commit is contained in:
Emil Ernerfeldt 2021-01-16 18:52:01 +01:00
parent 01bee768d9
commit 03c667149a
2 changed files with 5 additions and 1 deletions

View file

@ -506,6 +506,10 @@ impl MouseInput {
pos_history: self.pos_history,
}
}
pub fn is_moving(&self) -> bool {
self.velocity != Vec2::zero()
}
}
impl RawInput {

View file

@ -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);
}