diff options
author | 2020-02-24 20:10:20 +0100 | |
---|---|---|
committer | 2020-02-24 20:10:20 +0100 | |
commit | c47e30e960a403631b6dff7a522a775050d59f87 (patch) | |
tree | 43a422ebe5e9fa84d86e33ced19e6c071c7fd56e | |
parent | c6c8cabdaf03f90b1739be828cf140d8ddb92e65 (diff) | |
download | iced-c47e30e960a403631b6dff7a522a775050d59f87.tar.gz iced-c47e30e960a403631b6dff7a522a775050d59f87.tar.bz2 iced-c47e30e960a403631b6dff7a522a775050d59f87.zip |
double click fixed
-rw-r--r-- | native/src/input/mouse.rs | 2 | ||||
-rw-r--r-- | native/src/widget/text_input.rs | 8 |
2 files changed, 4 insertions, 6 deletions
diff --git a/native/src/input/mouse.rs b/native/src/input/mouse.rs index 22c81e15..eaac52f3 100644 --- a/native/src/input/mouse.rs +++ b/native/src/input/mouse.rs @@ -39,7 +39,6 @@ impl State { /// return amount of repetitive mouse clicks /// (1 -> double click, 2 -> triple click) pub fn update(&mut self, position: Point) -> Interaction { - self.last_click_timestamp = Some(SystemTime::now()); self.last_click = match self.last_click { None => Some(Interaction::Click(position)), Some(x) => match x { @@ -54,6 +53,7 @@ impl State { _ => Some(Interaction::Click(position)), }, }; + self.last_click_timestamp = Some(SystemTime::now()); self.last_click.unwrap_or(Interaction::Click(position)) } diff --git a/native/src/widget/text_input.rs b/native/src/widget/text_input.rs index 4e7906a8..cadef11d 100644 --- a/native/src/widget/text_input.rs +++ b/native/src/widget/text_input.rs @@ -214,12 +214,10 @@ where match self.state.mouse.update(cursor_position) { Interaction::DoubleClick(_) => { + let end = self.state.cursor.end(); self.state.cursor.select_range( - self.value.previous_start_of_word( - self.state.cursor.end(), - ), - self.value - .next_end_of_word(self.state.cursor.end()), + self.value.previous_start_of_word(end), + self.value.next_end_of_word(end), ) } Interaction::TripleClick(_) => { |