pub struct TouchEvent {
pub id: TouchId,
pub phase: TouchPhase,
pub position: Point<Pixels>,
pub predicted_position: Option<Point<Pixels>>,
pub force: Option<f32>,
}Expand description
A raw touch event from the platform.
Dispatch contract (core implementation pending): a touch is hit-tested
once, at TouchPhase::Started, occlusion-aware; all subsequent events
for the same TouchId are delivered to the elements under the starting
position, even after the touch moves outside them.
Fields§
§id: TouchIdWhich touch this event belongs to.
phase: TouchPhaseThe phase of the touch.
position: Point<Pixels>The position of the touch in window coordinates.
predicted_position: Option<Point<Pixels>>Where the platform predicts the touch will be roughly one frame from
now, in the same coordinate space as position, when the platform
offers a prediction for a TouchPhase::Moved event.
Best-effort latency compensation only: it may influence how far a recognized pan scrolls within a frame, but never hit testing, gesture classification, or velocity estimation, and any error it introduces must be corrected by later events for the same touch.
force: Option<f32>Normalized touch force in 0.0..=1.0, if the hardware reports it.
Trait Implementations§
Source§impl Clone for TouchEvent
impl Clone for TouchEvent
Source§fn clone(&self) -> TouchEvent
fn clone(&self) -> TouchEvent
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TouchEvent
impl Debug for TouchEvent
Source§impl Default for TouchEvent
impl Default for TouchEvent
Source§fn default() -> TouchEvent
fn default() -> TouchEvent
Source§impl InputEvent for TouchEvent
impl InputEvent for TouchEvent
Source§fn to_platform_input(self) -> PlatformInput
fn to_platform_input(self) -> PlatformInput
Auto Trait Implementations§
impl Freeze for TouchEvent
impl RefUnwindSafe for TouchEvent
impl Send for TouchEvent
impl Sync for TouchEvent
impl Unpin for TouchEvent
impl UnsafeUnpin for TouchEvent
impl UnwindSafe for TouchEvent
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().