Skip to content

Commit 2ce5462

Browse files
Fix double click travel
1 parent 887769e commit 2ce5462

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

desktop/src/cef/input.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,8 @@ impl ClickTracker {
246246
return ClickCount::Single;
247247
};
248248

249-
let previous = record.time;
249+
let prev_time = record.time;
250+
let prev_position = record.position;
250251

251252
let now = Instant::now();
252253
record.time = now;
@@ -270,10 +271,10 @@ impl ClickTracker {
270271
_ => {}
271272
}
272273

273-
let dx = position.x.abs_diff(record.position.x);
274-
let dy = position.y.abs_diff(record.position.y);
274+
let dx = position.x.abs_diff(prev_position.x);
275+
let dy = position.y.abs_diff(prev_position.y);
275276
let within_dist = dx <= MULTICLICK_ALLOWED_TRAVEL && dy <= MULTICLICK_ALLOWED_TRAVEL;
276-
let within_time = now.saturating_duration_since(previous) <= MULTICLICK_TIMEOUT;
277+
let within_time = now.saturating_duration_since(prev_time) <= MULTICLICK_TIMEOUT;
277278

278279
let count = if within_time && within_dist { ClickCount::Double } else { ClickCount::Single };
279280

0 commit comments

Comments
 (0)