Skip to main content

TouchPoint

Struct TouchPoint 

Source
#[repr(C)]
pub struct TouchPoint { pub id: u64, pub seat_id: u64, pub position: LogicalPosition, pub force: f32, pub major: f32, pub minor: f32, pub orientation_rad: f32, pub tool_type: TouchToolType, }
Expand description

Single touch point (finger, stylus, etc.)

Fields§

§id: u64

Unique identifier for this touch point (persists across move events)

§seat_id: u64

Which SEAT’s touchscreen this contact is on (9b-ii-a-i-c): a second seat’s fingers have their own id space (Wayland wl_touch ids are per seat, X11 touch events carry their master pointer), so a contact is identified by (seat_id, id). PRIMARY_POINTER_SEAT for the one touchscreen every other platform has.

§position: LogicalPosition

Current position of the touch point in logical coordinates

§force: f32

Force/pressure of the touch (0.0 = no pressure, 1.0 = maximum pressure) Set to 0.5 if pressure is not available

§major: f32

Major axis of the contact ellipse, in logical px. 0.0 = not reported.

A contact is an area, not a point, and every platform says so: Wayland wl_touch.shape, Windows POINTER_TOUCH_INFO.rcContact, Android AXIS_TOUCH_MAJOR. Without it there is no palm rejection, no brush-size-from-fingertip, and no way to size a hit target to a thumb rather than to a mouse cursor.

§minor: f32

Minor axis of the contact ellipse, in logical px. 0.0 = not reported.

§orientation_rad: f32

Rotation of the contact ellipse, radians clockwise from the x-axis. 0.0 when unreported OR when a circular contact makes it meaningless — check major/minor before trusting it.

§tool_type: TouchToolType

What is touching. Unknown where the platform does not classify.

Trait Implementations§

Source§

impl Clone for TouchPoint

Source§

fn clone(&self) -> TouchPoint

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for TouchPoint

Source§

impl Debug for TouchPoint

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl FromIterator<TouchPoint> for TouchPointVec

Source§

fn from_iter<T>(iter: T) -> Self
where T: IntoIterator<Item = TouchPoint>,

Creates a value from an iterator. Read more
Source§

impl PartialEq for TouchPoint

Source§

fn eq(&self, other: &TouchPoint) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl PartialOrd for TouchPoint

Source§

fn partial_cmp(&self, other: &TouchPoint) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl StructuralPartialEq for TouchPoint

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.