Skip to main content

PointerData

Struct PointerData 

Source
pub struct PointerData {
Show 36 fields pub view_id: ViewId, pub embedder_id: i64, pub time_stamp: Duration, pub change: PointerChange, pub kind: PointerDeviceKind, pub signal_kind: Option<PointerSignalKind>, pub device: i64, pub pointer_identifier: i64, pub physical_x: f64, pub physical_y: f64, pub physical_delta_x: f64, pub physical_delta_y: f64, pub buttons: i64, pub obscured: bool, pub synthesized: bool, pub pressure: f64, pub pressure_min: f64, pub pressure_max: f64, pub distance: f64, pub distance_max: f64, pub size: f64, pub radius_major: f64, pub radius_minor: f64, pub radius_min: f64, pub radius_max: f64, pub orientation: f64, pub tilt: f64, pub platform_data: i64, pub scroll_delta_x: f64, pub scroll_delta_y: f64, pub pan_x: f64, pub pan_y: f64, pub pan_delta_x: f64, pub pan_delta_y: f64, pub scale: f64, pub rotation: f64,
}
Expand description

Information about the state of a pointer.

Fields§

§view_id: ViewId

The ID of the crate::View this pointer event originated from.

§embedder_id: i64

Unique identifier that ties the pointer event to the embedder event that created it.

No two pointer events can have the same embedder_id. This is different from pointer_identifier - used for hit-testing, whereas embedder_id is used to identify the platform event.

§time_stamp: Duration

Time of event dispatch, relative to an arbitrary timeline.

§change: PointerChange

How the pointer has changed since the last report.

§kind: PointerDeviceKind

The kind of input device for which the event was generated.

§signal_kind: Option<PointerSignalKind>

The kind of signal for a pointer signal event.

§device: i64

Unique identifier for the pointing device, reused across interactions.

§pointer_identifier: i64

Unique identifier for the pointer.

This field changes for each new pointer down event. Framework uses this identifier to determine hit test result.

§physical_x: f64

X coordinate of the position of the pointer, in physical pixels in the global coordinate space.

§physical_y: f64

Y coordinate of the position of the pointer, in physical pixels in the global coordinate space.

§physical_delta_x: f64

The distance of pointer movement on X coordinate in physical pixels.

§physical_delta_y: f64

The distance of pointer movement on Y coordinate in physical pixels.

§buttons: i64

Bit field using the *Button constants (primaryMouseButton, secondaryStylusButton, etc). For example, if this has the value 6 and the kind is PointerDeviceKind::InvertedStylus, then this indicates an upside-down stylus with both its primary and secondary buttons pressed.

§obscured: bool

Set if an application from a different security domain is in any way obscuring this application’s window. (Aspirational; not currently implemented.)

§synthesized: bool

Set if this pointer data was synthesized by pointer data packet converter. pointer data packet converter will synthesize additional pointer datas if the input sequence of pointer data is illegal.

For example, a down pointer data will be synthesized if the converter receives a move pointer data while the pointer is not previously down.

§pressure: f64

The pressure of the touch as a number ranging from 0.0, indicating a touch with no discernible pressure, to 1.0, indicating a touch with “normal” pressure, and possibly beyond, indicating a stronger touch. For devices that do not detect pressure (e.g. mice), returns 1.0.

§pressure_min: f64

The minimum value that pressure can return for this pointer. For devices that do not detect pressure (e.g. mice), returns 1.0. This will always be a number less than or equal to 1.0.

§pressure_max: f64

The maximum value that pressure can return for this pointer. For devices that do not detect pressure (e.g. mice), returns 1.0. This will always be a greater than or equal to 1.0.

§distance: f64

The distance of the detected object from the input surface (e.g. the distance of a stylus or finger from a touch screen), in arbitrary units on an arbitrary (not necessarily linear) scale. If the pointer is down, this is 0.0 by definition.

§distance_max: f64

The maximum value that a distance can return for this pointer. If this input device cannot detect “hover touch” input events, then this will be 0.0.

§size: f64

The area of the screen being pressed, scaled to a value between 0 and 1. The value of size can be used to determine fat touch events. This value is only set on Android, and is a device specific approximation within the range of detectable values. So, for example, the value of 0.1 could mean a touch with the tip of the finger, 0.2 a touch with full finger, and 0.3 the full palm.

§radius_major: f64

The radius of the contact ellipse along the major axis, in logical pixels.

§radius_minor: f64

The radius of the contact ellipse along the minor axis, in logical pixels.

§radius_min: f64

The minimum value that could be reported for radiusMajor and radiusMinor for this pointer, in logical pixels.

§radius_max: f64

The maximum value that could be reported for radiusMajor and radiusMinor for this pointer, in logical pixels.

§orientation: f64

For PointerDeviceKind::Touch events:

The angle of the contact ellipse, in radius in the range:

-pi/2 < orientation <= pi/2

…giving the angle of the major axis of the ellipse with the y-axis (negative angles indicating an orientation along the top-left / bottom-right diagonal, positive angles indicating an orientation along the top-right / bottom-left diagonal, and zero indicating an orientation parallel with the y-axis).

For PointerDeviceKind::Stylus and PointerDeviceKind::InvertedStylus events:

The angle of the stylus, in radians in the range:

-pi < orientation <= pi

…giving the angle of the axis of the stylus projected onto the input surface, relative to the positive y-axis of that surface (thus 0.0 indicates the stylus, if projected onto that surface, would go from the contact point vertically up in the positive y-axis direction, pi would indicate that the stylus would go down in the negative y-axis direction; pi/4 would indicate that the stylus goes up and to the right, -pi/2 would indicate that the stylus goes to the left, etc).

§tilt: f64

For PointerDeviceKind::Stylus and PointerDeviceKind::InvertedStylus events:

The angle of the stylus, in radians in the range:

0 <= tilt <= pi/2

…giving the angle of the axis of the stylus, relative to the axis perpendicular to the input surface (thus 0.0 indicates the stylus is orthogonal to the plane of the input surface, while pi/2 indicates that the stylus is flat on that surface).

§platform_data: i64

Opaque platform-specific data associated with the event.

§scroll_delta_x: f64

For events with signalKind of PointerSignalKind::Scroll:

The amount to scroll in the x direction, in physical pixels.

§scroll_delta_y: f64

For events with signalKind of PointerSignalKind::Scroll:

The amount to scroll in the y direction, in physical pixels.

§pan_x: f64

For events with change of PointerChange::PanZoomUpdate:

The current panning magnitude of the pan/zoom in the x direction, in physical pixels.

§pan_y: f64

For events with change of PointerChange::PanZoomUpdate:

The current panning magnitude of the pan/zoom in the y direction, in physical pixels.

§pan_delta_x: f64

For events with change of PointerChange::PanZoomUpdate:

The difference in panning of the pan/zoom in the x direction since the latest panZoomUpdate event, in physical pixels.

§pan_delta_y: f64

For events with change of PointerChange::PanZoomUpdate:

The difference in panning of the pan/zoom in the y direction since the last panZoomUpdate event, in physical pixels.

§scale: f64

For events with change of PointerChange::PanZoomUpdate:

The current scale of the pan/zoom (unitless), with 1.0 as the initial scale.

§rotation: f64

For events with change of PointerChange::PanZoomUpdate:

The current angle of the pan/zoom in radians, with 0.0 as the initial angle.

Implementations§

Source§

impl PointerData

Source

pub fn to_string_full(&self) -> String

Returns a complete textual description of the information in this object.

Trait Implementations§

Source§

impl Clone for PointerData

Source§

fn clone(&self) -> PointerData

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 PointerData

Source§

impl Debug for PointerData

Source§

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

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

impl Default for PointerData

Source§

fn default() -> PointerData

Returns the “default value” for a type. Read more
Source§

impl Display for PointerData

Source§

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

Formats the value using the given formatter. Read more

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Downcast<T> for T

Source§

fn downcast(&self) -> &T

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,