double click fixed
This commit is contained in:
parent
c6c8cabdaf
commit
c47e30e960
2 changed files with 4 additions and 6 deletions
|
|
@ -39,7 +39,6 @@ impl State {
|
||||||
/// return amount of repetitive mouse clicks
|
/// return amount of repetitive mouse clicks
|
||||||
/// (1 -> double click, 2 -> triple click)
|
/// (1 -> double click, 2 -> triple click)
|
||||||
pub fn update(&mut self, position: Point) -> Interaction {
|
pub fn update(&mut self, position: Point) -> Interaction {
|
||||||
self.last_click_timestamp = Some(SystemTime::now());
|
|
||||||
self.last_click = match self.last_click {
|
self.last_click = match self.last_click {
|
||||||
None => Some(Interaction::Click(position)),
|
None => Some(Interaction::Click(position)),
|
||||||
Some(x) => match x {
|
Some(x) => match x {
|
||||||
|
|
@ -54,6 +53,7 @@ impl State {
|
||||||
_ => Some(Interaction::Click(position)),
|
_ => Some(Interaction::Click(position)),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
self.last_click_timestamp = Some(SystemTime::now());
|
||||||
self.last_click.unwrap_or(Interaction::Click(position))
|
self.last_click.unwrap_or(Interaction::Click(position))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -214,12 +214,10 @@ where
|
||||||
|
|
||||||
match self.state.mouse.update(cursor_position) {
|
match self.state.mouse.update(cursor_position) {
|
||||||
Interaction::DoubleClick(_) => {
|
Interaction::DoubleClick(_) => {
|
||||||
|
let end = self.state.cursor.end();
|
||||||
self.state.cursor.select_range(
|
self.state.cursor.select_range(
|
||||||
self.value.previous_start_of_word(
|
self.value.previous_start_of_word(end),
|
||||||
self.state.cursor.end(),
|
self.value.next_end_of_word(end),
|
||||||
),
|
|
||||||
self.value
|
|
||||||
.next_end_of_word(self.state.cursor.end()),
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
Interaction::TripleClick(_) => {
|
Interaction::TripleClick(_) => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue