summaryrefslogtreecommitdiffstats
path: root/native
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2022-01-28 18:43:20 +0700
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2022-01-28 21:37:17 +0700
commite730d97f61bc2edc77d2f061b6a763c4d0a948df (patch)
tree8966e2ad3b093c83295b3ad0c5b8d1c460a1c158 /native
parent167be45a7db7c1f60a79116766bdf38300429c6a (diff)
downloadiced-e730d97f61bc2edc77d2f061b6a763c4d0a948df.tar.gz
iced-e730d97f61bc2edc77d2f061b6a763c4d0a948df.tar.bz2
iced-e730d97f61bc2edc77d2f061b6a763c4d0a948df.zip
Implement `time` module for `wasm-bindgen` backend in `iced_futures`
Diffstat (limited to 'native')
-rw-r--r--native/src/mouse/click.rs9
1 files changed, 7 insertions, 2 deletions
diff --git a/native/src/mouse/click.rs b/native/src/mouse/click.rs
index ec321387..4a7d796c 100644
--- a/native/src/mouse/click.rs
+++ b/native/src/mouse/click.rs
@@ -62,9 +62,14 @@ impl Click {
}
fn is_consecutive(&self, new_position: Point, time: Instant) -> bool {
+ let duration = if time > self.time {
+ Some(time - self.time)
+ } else {
+ None
+ };
+
self.position == new_position
- && time
- .checked_duration_since(self.time)
+ && duration
.map(|duration| duration.as_millis() <= 300)
.unwrap_or(false)
}