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
impl TouchAction
Sourcepub const NONE: Self
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.
Sourcepub const PINCH_ZOOM: Self
pub const PINCH_ZOOM: Self
Pinch-to-zoom only.
Sourcepub const MANIPULATION: Self
pub const MANIPULATION: Self
Panning and pinch-zoom, but no other browser-style default gesture
(PAN | PINCH_ZOOM).
Sourcepub const fn intersect(self, other: Self) -> Self
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).
Sourcepub const fn allows_pan(self, axis: Axis) -> bool
pub const fn allows_pan(self, axis: Axis) -> bool
Whether panning is permitted on axis.
Sourcepub const fn allows_pan_x(self) -> bool
pub const fn allows_pan_x(self) -> bool
Whether horizontal panning is permitted. Sugar for
allows_pan(Axis::X).
Sourcepub const fn allows_pan_y(self) -> bool
pub const fn allows_pan_y(self) -> bool
Whether vertical panning is permitted. Sugar for
allows_pan(Axis::Y).
Sourcepub const fn allows_pinch(self) -> bool
pub const fn allows_pinch(self) -> bool
Whether pinch-to-zoom is permitted.
Sourcepub const fn allows_delayed_gestures(self) -> bool
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.
Trait Implementations§
Source§impl BitAnd for TouchAction
impl BitAnd for TouchAction
Source§impl BitOr for TouchAction
impl BitOr for TouchAction
Source§impl Clone for TouchAction
impl Clone for TouchAction
Source§fn clone(&self) -> TouchAction
fn clone(&self) -> TouchAction
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for TouchAction
Source§impl Debug for TouchAction
impl Debug for TouchAction
Source§impl Default for TouchAction
impl Default for TouchAction
Source§fn default() -> Self
fn default() -> Self
Self::AUTO — a node that declares nothing permits everything,
exactly like the CSS property it mirrors.