Fix text selection with touch events in TextInput

This commit is contained in:
Héctor Ramón Jiménez 2020-12-15 06:48:12 +01:00
parent 056f7e6951
commit 70164f68a6

View File

@ -320,10 +320,13 @@ where
return event::Status::Captured; return event::Status::Captured;
} }
} }
Event::Mouse(mouse::Event::ButtonReleased(mouse::Button::Left)) => { Event::Mouse(mouse::Event::ButtonReleased(mouse::Button::Left))
| Event::Touch(touch::Event::FingerLifted { .. })
| Event::Touch(touch::Event::FingerLost { .. }) => {
self.state.is_dragging = false; self.state.is_dragging = false;
} }
Event::Mouse(mouse::Event::CursorMoved { position }) => { Event::Mouse(mouse::Event::CursorMoved { position })
| Event::Touch(touch::Event::FingerMoved { position, .. }) => {
if self.state.is_dragging { if self.state.is_dragging {
let text_layout = layout.children().next().unwrap(); let text_layout = layout.children().next().unwrap();
let target = position.x - text_layout.bounds().x; let target = position.x - text_layout.bounds().x;