Implement time module for wasm-bindgen backend in iced_futures

This commit is contained in:
Héctor Ramón Jiménez 2022-01-28 18:43:20 +07:00
parent 167be45a7d
commit e730d97f61
No known key found for this signature in database
GPG key ID: 140CC052C94F138E
7 changed files with 61 additions and 21 deletions

View file

@ -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)
}