pub enum Force {
Calibrated {
force: f64,
max_possible_force: f64,
altitude_angle: Option<f64>,
},
Normalized(f64),
}
Expand description
Describes the force of a touch event
Fields
The 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.
The maximum possible force for a touch.
The value of this field is sufficiently high to provide a wide
dynamic range for values of the force
field.
The altitude (in radians) of the stylus.
A value of 0 radians indicates that the stylus is parallel to the
surface. The value of this property is Pi/2 when the stylus is
perpendicular to the surface.
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.
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 really hard, or not hard at all, depending on the device.
Returns the force normalized to the range between 0.0 and 1.0 inclusive.
Instead of normalizing the force, you should prefer to handle
Force::Calibrated
so that the amount of force the user has to apply is
consistent across devices.
Performs copy-assignment from
source
.
Read more
Formats the value using the given formatter.
Read more
This method tests for self
and other
values to be equal, and is used
by ==
.
This method tests for !=
. The default implementation is almost always
sufficient, and should not be overridden without very good reason.
Immutably borrows from an owned value.
Read more
Mutably borrows from an owned value.
Read more
Returns the argument unchanged.
Instruments this type with the provided
Span
, returning an
Instrumented
wrapper.
Read more
Calls U::from(self)
.
That is, this conversion is whatever the implementation of
From<T> for U
chooses to do.
The alignment of pointer.
The type for initializers.
Initializes a with the given initializer.
Read more
Mutably dereferences the given pointer.
Read more
Drops the object pointed to by the given pointer.
Read more
Converts to T
by calling Into<T>::into
.
Tries to convert to T
by calling TryInto<T>::try_into
.
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning.
Read more
Uses borrowed data to replace owned data, usually by cloning.
Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.