Skip to main content

TouchAction

Struct TouchAction 

Source
pub struct TouchAction(/* private fields */);
Expand description

What a direct pointer (touch, pen) is permitted to do to a subtree, declared per node and intersected down the tree — the CSS touch-action model.

A bitset over three permissions (pan-x, pan-y, pinch-zoom), plus the two absorbing/identity extremes AUTO (everything permitted — the default) and NONE (nothing permitted). AUTO occupies every bit of the backing u8, not just the three named ones, so it stays the identity element for intersect even if a later package adds a fourth permission bit: intersecting anything with a value that has every bit set can never clear a bit the other side already had.

A mouse never reads this type at all — see the module docs.

Implementations§

Source§

impl TouchAction

Source

pub const AUTO: Self

Every default touch behaviour is permitted. The identity element for intersect and Default.

Source

pub const NONE: Self

No default touch behaviour is permitted — the subtree wants every contact reserved for its own gesture handling. The absorbing element for intersect: once any ancestor declares NONE, nothing below it can un-forbid anything.

Source

pub const PAN_X: Self

Horizontal panning only.

Source

pub const PAN_Y: Self

Vertical panning only.

Source

pub const PAN: Self

Panning on either axis (PAN_X | PAN_Y).

Source

pub const PINCH_ZOOM: Self

Pinch-to-zoom only.

Source

pub const MANIPULATION: Self

Panning and pinch-zoom, but no other browser-style default gesture (PAN | PINCH_ZOOM).

Source

pub const fn intersect(self, other: Self) -> Self

The permissions both sides agree on — bitwise AND. Associative, commutative, AUTO is the identity, NONE is absorbing (all tested by intersect_forms_a_commutative_monoid_with_auto_and_none_at_its_poles below).

Source

pub const fn union(self, other: Self) -> Self

The permissions either side allows — bitwise OR.

Source

pub const fn allows_pan(self, axis: Axis) -> bool

Whether panning is permitted on axis.

Source

pub const fn allows_pan_x(self) -> bool

Whether horizontal panning is permitted. Sugar for allows_pan(Axis::X).

Source

pub const fn allows_pan_y(self) -> bool

Whether vertical panning is permitted. Sugar for allows_pan(Axis::Y).

Source

pub const fn allows_pinch(self) -> bool

Whether pinch-to-zoom is permitted.

Source

pub const fn allows_delayed_gestures(self) -> bool

Whether any delayed gesture recognition (long-press, a slop-gated drag) may still run on this subtree — true unless the whole action is NONE. A subtree that reserves every touch behaviour for itself gets its response immediately, with no arbitration delay.

Source

pub const fn is_none(self) -> bool

Whether this is NONE — nothing permitted.

Trait Implementations§

Source§

impl BitAnd for TouchAction

Source§

type Output = TouchAction

The resulting type after applying the & operator.
Source§

fn bitand(self, rhs: Self) -> Self

Performs the & operation. Read more
Source§

impl BitOr for TouchAction

Source§

type Output = TouchAction

The resulting type after applying the | operator.
Source§

fn bitor(self, rhs: Self) -> Self

Performs the | operation. Read more
Source§

impl Clone for TouchAction

Source§

fn clone(&self) -> TouchAction

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for TouchAction

Source§

impl Debug for TouchAction

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for TouchAction

Source§

fn default() -> Self

Self::AUTO — a node that declares nothing permits everything, exactly like the CSS property it mirrors.

Source§

impl Eq for TouchAction

Source§

impl PartialEq for TouchAction

Source§

fn eq(&self, other: &TouchAction) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for TouchAction

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.