[][src]Enum glutin::event::Force

pub enum Force {
    Calibrated {
        force: f64,
        max_possible_force: f64,
        altitude_angle: Option<f64>,
    },
    Normalized(f64),
}

Describes the force of a touch event

Variants

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 of Calibrated

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.

altitude_angle: Option<f64>

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.

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 really hard, or not hard at all, depending on the device.

Implementations

impl Force[src]

pub fn normalized(&self) -> f64[src]

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

impl Clone for Force[src]

impl Copy for Force[src]

impl Debug for Force[src]

impl PartialEq<Force> for Force[src]

impl StructuralPartialEq for Force[src]

Auto Trait Implementations

impl RefUnwindSafe for Force

impl Send for Force

impl Sync for Force

impl Unpin for Force

impl UnwindSafe for Force

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.