mirror of
https://github.com/emilk/egui.git
synced 2026-09-02 14:50:03 -04:00
TextEdit: only show cursor preview when moving mouse
This commit is contained in:
@@ -506,6 +506,10 @@ impl MouseInput {
|
|||||||
pos_history: self.pos_history,
|
pos_history: self.pos_history,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn is_moving(&self) -> bool {
|
||||||
|
self.velocity != Vec2::zero()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl RawInput {
|
impl RawInput {
|
||||||
|
|||||||
@@ -324,7 +324,7 @@ impl<'t> TextEdit<'t> {
|
|||||||
|
|
||||||
let cursor_at_mouse = galley.cursor_from_pos(mouse_pos - response.rect.min);
|
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:
|
// preview:
|
||||||
paint_cursor_end(ui, response.rect.min, &galley, &cursor_at_mouse);
|
paint_cursor_end(ui, response.rect.min, &galley, &cursor_at_mouse);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user