summaryrefslogtreecommitdiffstats
path: root/native
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-11-19 02:45:09 +0100
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-11-19 02:45:47 +0100
commit140bea352e4d51a56f1c4de08581d88181cb9960 (patch)
tree21234e21182b89b3739c1e97dd230496d80a0e6a /native
parentc03d46719ef79a796e03dab394248a55d92e0fbd (diff)
downloadiced-140bea352e4d51a56f1c4de08581d88181cb9960.tar.gz
iced-140bea352e4d51a56f1c4de08581d88181cb9960.tar.bz2
iced-140bea352e4d51a56f1c4de08581d88181cb9960.zip
Disable dragging in `TextInput` after double click
When using a trackpad, mouse move events may happen between the press/release events. This was incorrectly triggering selection dragging in the `TextInput` widget. Eventually, we should implement proper word-aware selection dragging.
Diffstat (limited to 'native')
-rw-r--r--native/src/widget/text_input.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/native/src/widget/text_input.rs b/native/src/widget/text_input.rs
index 6d194db5..c067de77 100644
--- a/native/src/widget/text_input.rs
+++ b/native/src/widget/text_input.rs
@@ -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;
}
}