pub struct DoubleTap { /* private fields */ }Expand description
A double tap: two presses, the first no longer than
DoubleTap::tap_time, the second going down within
DoubleTap::window of the first coming up.
Fires on the second press unless made with DoubleTap::on_release.
The fields are private so the only double taps that exist are ones the evaluator can time.
Implementations§
Source§impl DoubleTap
impl DoubleTap
Sourcepub fn new(tap_time: f32, window: f32) -> Option<Self>
pub fn new(tap_time: f32, window: f32) -> Option<Self>
A double tap that fires on the second press, or None unless both times
are finite and positive.
Sourcepub const fn on_release(self) -> Self
pub const fn on_release(self) -> Self
This double tap, firing on the second press’s release instead of
on the press — and only if that press lasted at most
DoubleTap::tap_time, as the first had to. See the module docs.
Sourcepub const fn fires_on_release(self) -> bool
pub const fn fires_on_release(self) -> bool
Whether it fires on the second press’s release rather than the press.
Sourcepub const fn tap_time(self) -> f32
pub const fn tap_time(self) -> f32
The longest the first press can last, in seconds — and, for a double
tap made with DoubleTap::on_release, the second.
Trait Implementations§
impl Copy for DoubleTap
Source§impl Default for DoubleTap
impl Default for DoubleTap
Source§fn default() -> Self
fn default() -> Self
A first press of at most TAP_TIME, and a gap of at most
DOUBLE_TAP_WINDOW, firing on the second press.