#[non_exhaustive]pub struct Touch {
pub id: u64,
pub phase: TouchPhase,
pub location: Point,
pub pressure: f64,
pub kind: PointerKind,
}Expand description
One contact of a raw multi-touch event (Decorate::on_touches, docs/gestures.md “Touches”).
Build one with Touch::new, then Touch::with_pressure and Touch::with_kind.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.id: u64Stable for the life of the contact, from Began to Ended or Cancelled; reused
afterwards.
phase: TouchPhase§location: PointIn the piece’s own coordinates, in points.
pressure: f64Contact force from 0 to 1; 1 where the device reports none.
kind: PointerKindThe device behind the contact.
Implementations§
Source§impl Touch
impl Touch
Sourcepub fn new(id: u64, phase: TouchPhase, location: Point) -> Touch
pub fn new(id: u64, phase: TouchPhase, location: Point) -> Touch
A finger contact at full pressure.
Sourcepub fn with_pressure(self, pressure: f64) -> Touch
pub fn with_pressure(self, pressure: f64) -> Touch
This contact with a reported force (clamped to 0 through 1).
Sourcepub fn with_kind(self, kind: PointerKind) -> Touch
pub fn with_kind(self, kind: PointerKind) -> Touch
This contact from another kind of device.
Trait Implementations§
impl Copy for Touch
impl StructuralPartialEq for Touch
Auto Trait Implementations§
impl Forget for Touch
impl Freeze for Touch
impl Move for Touch
impl RefUnwindSafe for Touch
impl Send for Touch
impl Sync for Touch
impl Unpin for Touch
impl UnsafeUnpin for Touch
impl UnwindSafe for Touch
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more