Skip to content

Commit c3f7912

Browse files
try another way
1 parent 7870434 commit c3f7912

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

desktop/src/cef/input.rs

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,28 @@ impl ClickTracker {
253253
return ClickCount::Single;
254254
};
255255

256+
match state {
257+
ElementState::Pressed if record.down_count == ClickCount::Double => {
258+
*record = ClickRecord {
259+
time: now,
260+
position: position.clone(),
261+
down_count: ClickCount::Single,
262+
up_count: record.up_count.clone(),
263+
};
264+
return ClickCount::Single;
265+
}
266+
ElementState::Released if record.up_count == ClickCount::Double => {
267+
*record = ClickRecord {
268+
time: now,
269+
position: position.clone(),
270+
down_count: record.down_count.clone(),
271+
up_count: ClickCount::Single,
272+
};
273+
return ClickCount::Single;
274+
}
275+
_ => {}
276+
}
277+
256278
let dx = position.x.abs_diff(record.position.x);
257279
let dy = position.y.abs_diff(record.position.y);
258280
let within_dist = dx <= MULTICLICK_ALLOWED_TRAVEL && dy <= MULTICLICK_ALLOWED_TRAVEL;
@@ -278,7 +300,7 @@ impl ClickTracker {
278300
}
279301
}
280302

281-
#[derive(Clone)]
303+
#[derive(Clone, PartialEq)]
282304
enum ClickCount {
283305
Single,
284306
Double,

0 commit comments

Comments
 (0)