Merge pull request #620 from hecrj/fix/trackpad-text-input-selection

Disable dragging in `TextInput` after double click
This commit is contained in:
Héctor Ramón 2020-11-20 00:33:48 +01:00 committed by GitHub
commit 1af6fb3ec0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -278,7 +278,6 @@ where
Event::Mouse(mouse::Event::ButtonPressed(mouse::Button::Left)) => {
let is_clicked = layout.bounds().contains(cursor_position);
self.state.is_dragging = is_clicked;
self.state.is_focused = is_clicked;
if is_clicked {
@ -312,6 +311,8 @@ where
} else {
self.state.cursor.move_to(0);
}
self.state.is_dragging = true;
}
click::Kind::Double => {
if self.is_secure {
@ -331,9 +332,12 @@ where
self.value.next_end_of_word(position),
);
}
self.state.is_dragging = false;
}
click::Kind::Triple => {
self.state.cursor.select_all(&self.value);
self.state.is_dragging = false;
}
}