pub struct Touch {
pub device_id: DeviceId,
pub phase: TouchPhase,
pub location: PhysicalPosition<f64>,
pub force: Option<Force>,
pub id: u64,
}
Expand description
Represents a touch event
Every time the user touches the screen, a new TouchPhase::Started
event with an unique
identifier for the finger is generated. When the finger is lifted, an TouchPhase::Ended
event is generated with the same finger id.
After a Started
event has been emitted, there may be zero or more Move
events when the finger is moved or the touch pressure changes.
The finger id may be reused by the system after an Ended
event. The user
should assume that a new Started
event received with the same id has nothing
to do with the old finger and is a new finger.
A TouchPhase::Cancelled
event is emitted when the system has canceled tracking this
touch, such as when the window loses focus, or on iOS if the user moves the
device against their face.
§Platform-specific
Fields§
§device_id: DeviceId
§phase: TouchPhase
§location: PhysicalPosition<f64>
§force: Option<Force>
Describes how hard the screen was pressed. May be None
if the platform
does not support pressure sensitivity.
§Platform-specific
- Only available on iOS 9.0+, Windows 8+, Web, and Android.
- Android: This will never be None. If the device doesn’t support pressure sensitivity, force will either be 0.0 or 1.0. Also see the android documentation.
id: u64
Unique identifier of a finger.
Trait Implementations§
source§impl PartialEq for Touch
impl PartialEq for Touch
impl Copy for Touch
impl StructuralPartialEq for Touch
Auto Trait Implementations§
impl Freeze for Touch
impl RefUnwindSafe for Touch
impl Send for Touch
impl Sync for Touch
impl Unpin 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
source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.