Enum winit::event::Force [−][src]
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
Variants
Calibrated
Fields
force: f64
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.
max_possible_force: f64
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.
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.
Normalized(f64)
Tuple Fields
0: 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 really hard, or not hard at all, depending on the device.
Implementations
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.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Force
impl UnwindSafe for Force
Blanket Implementations
Mutably borrows from an owned value. Read more