pub enum TouchPhase {
Began,
Moved,
Ended,
Cancelled,
}Expand description
Input vocabulary, defined in crcbl_core::input and re-exported so a
consumer of the event stream needs one use rather than two.
See the crate docs for why these live in crcbl-core.
Where a ContactId is in its gesture.
A touchscreen has no “hover”: a contact exists from the moment it lands until
the moment it goes away, so this is the lifecycle rather than a button state
— which is why touch does not reuse ButtonState.
Variants§
Began
The finger landed. The first event any ContactId gets.
Moved
It moved while down.
Ended
The user lifted it. The gesture completed, and a consumer commits whatever it meant — a tap fires, a stick centres, a drag lands where it was let go.
Cancelled
The system took the gesture away: the OS claimed it for an edge swipe, palm rejection changed its mind, the window lost focus, the browser decided the page was scrolling after all.
Not an Ended, and a consumer that treats it as one
fires actions the user did not ask for. The position it carries is the
last one the platform knew, not a place anyone chose, so the answer is to
undo the interaction rather than complete it — the drag goes back, the
tap does not fire, the stick centres without the character having lunged.
What both share is that the contact is over: the id is gone either way,
and a consumer that ignores this one is left holding a finger that will
never move again.
Implementations§
Source§impl TouchPhase
impl TouchPhase
Sourcepub const fn ends_contact(self) -> bool
pub const fn ends_contact(self) -> bool
Trait Implementations§
Source§impl Clone for TouchPhase
impl Clone for TouchPhase
Source§fn clone(&self) -> TouchPhase
fn clone(&self) -> TouchPhase
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more