pub struct MutableInteractionSource { /* private fields */ }Expand description
Records the press and hover interactions of the nodes bound to it, and exposes them as state.
Implementations§
Source§impl MutableInteractionSource
impl MutableInteractionSource
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a source bound to the runtime of the composition that is active now.
Sourcepub fn with_runtime(runtime: RuntimeHandle) -> Self
pub fn with_runtime(runtime: RuntimeHandle) -> Self
Creates a source bound to runtime, for use outside composition.
Sourcepub fn id(&self) -> u64
pub fn id(&self) -> u64
Returns an id that is stable for this source and differs from the ids of other sources.
Sourcepub fn press(&self, press_position: Point) -> PressInteractionPress
pub fn press(&self, press_position: Point) -> PressInteractionPress
Reports a press at press_position in the node’s local coordinates, in logical pixels, and
returns the press to end with Self::release or Self::cancel.
Sourcepub fn release(&self, press: PressInteractionPress)
pub fn release(&self, press: PressInteractionPress)
Reports that press ended with the pointer going up.
Sourcepub fn cancel(&self, press: PressInteractionPress)
pub fn cancel(&self, press: PressInteractionPress)
Reports that press ended without the pointer going up.
Sourcepub fn enter_hover(&self) -> HoverInteractionEnter
pub fn enter_hover(&self) -> HoverInteractionEnter
Reports that a pointer came to rest over a node, Compose’s
emit(HoverInteraction.Enter()), and returns the enter to end it
with.
Sourcepub fn exit_hover(&self, enter: HoverInteractionEnter)
pub fn exit_hover(&self, enter: HoverInteractionEnter)
Reports that the pointer enter reported left.
Sourcepub fn emit(&self, interaction: Interaction)
pub fn emit(&self, interaction: Interaction)
Records interaction and updates the pressed and hovered state to match.
Sourcepub fn collectIsPressedAsState(&self) -> State<bool>
pub fn collectIsPressedAsState(&self) -> State<bool>
Returns whether the interaction source is currently pressed as a
reactive State.
Mirrors Jetpack Compose: InteractionSource.collectIsPressedAsState().
The value flips to true when a PressInteraction::Press is emitted
and back to false once every active press has seen a matching
PressInteraction::Release or PressInteraction::Cancel. Reading the
returned state inside a composable subscribes the enclosing recompose
scope, so the composable recomposes whenever the pressed state changes.
Sourcepub fn collectIsHoveredAsState(&self) -> State<bool>
pub fn collectIsHoveredAsState(&self) -> State<bool>
Returns whether a pointer rests over a node of this source as a
reactive State: true from a HoverInteraction::Enter until
every enter has seen its HoverInteraction::Exit.
Mirrors Jetpack Compose: InteractionSource.collectIsHoveredAsState().
Sourcepub fn collectLastInteractionAsState(&self) -> State<Option<Interaction>>
pub fn collectLastInteractionAsState(&self) -> State<Option<Interaction>>
Returns the interaction that happened last, or None before the first one, as a reactive
State.
Trait Implementations§
Source§impl Clone for MutableInteractionSource
impl Clone for MutableInteractionSource
impl Copy for MutableInteractionSource
Source§impl Debug for MutableInteractionSource
impl Debug for MutableInteractionSource
Source§impl Default for MutableInteractionSource
impl Default for MutableInteractionSource
impl Eq for MutableInteractionSource
Auto Trait Implementations§
impl Freeze for MutableInteractionSource
impl RefUnwindSafe for MutableInteractionSource
impl Send for MutableInteractionSource
impl Sync for MutableInteractionSource
impl Unpin for MutableInteractionSource
impl UnsafeUnpin for MutableInteractionSource
impl UnwindSafe for MutableInteractionSource
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more