#[non_exhaustive]pub enum TouchForce {
Calibrated {
force: f64,
max_possible_force: f64,
altitude_angle: Option<f64>,
},
Normalized(f64),
}Expand description
Describes the force of a touch event.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Calibrated
On iOS, the force is calibrated so that the same number corresponds to roughly the same amount of pressure on the screen regardless of the device.
Fields
force: f64The force of the touch, where a value of 1.0 represents the force of an average touch (predetermined by the system, not user-specific).
The force reported by Apple Pencil is measured along the axis of the
pencil. If you want a force perpendicular to the device, you need to
calculate this value using the altitude_angle value.
Normalized(f64)
If the platform reports the force as normalized, we have no way of knowing how much pressure 1.0 corresponds to – we know it’s the maximum amount of force, but as to how much force, you might either have to press really hard, or not hard at all, depending on the device.
Trait Implementations§
Source§impl Clone for TouchForce
impl Clone for TouchForce
Source§fn clone(&self) -> TouchForce
fn clone(&self) -> TouchForce
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TouchForce
impl Debug for TouchForce
Source§impl<'de> Deserialize<'de> for TouchForce
impl<'de> Deserialize<'de> for TouchForce
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for TouchForce
impl PartialEq for TouchForce
Source§impl Serialize for TouchForce
impl Serialize for TouchForce
impl Copy for TouchForce
impl StructuralPartialEq for TouchForce
Auto Trait Implementations§
impl Freeze for TouchForce
impl RefUnwindSafe for TouchForce
impl Send for TouchForce
impl Sync for TouchForce
impl Unpin for TouchForce
impl UnwindSafe for TouchForce
Blanket Implementations§
Source§impl<T> AnyVarValue for T
impl<T> AnyVarValue for T
Source§fn clone_boxed(&self) -> BoxAnyVarValue
fn clone_boxed(&self) -> BoxAnyVarValue
Source§fn eq_any(&self, other: &(dyn AnyVarValue + 'static)) -> bool
fn eq_any(&self, other: &(dyn AnyVarValue + 'static)) -> bool
self and other are equal.Source§fn try_swap(&mut self, other: &mut (dyn AnyVarValue + 'static)) -> bool
fn try_swap(&mut self, other: &mut (dyn AnyVarValue + 'static)) -> bool
other if both are of the same type.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 more