pub struct SwipeToDismissState { /* private fields */ }Expand description
Retained swipe state. Give each mounted swipe container its own entity.
Implementations§
Source§impl SwipeToDismissState
impl SwipeToDismissState
Sourcepub fn new() -> SwipeToDismissState
pub fn new() -> SwipeToDismissState
Creates a new swipe state settled at SwipeToDismissValue::Settled.
Sourcepub fn initial_value(self, value: SwipeToDismissValue) -> SwipeToDismissState
pub fn initial_value(self, value: SwipeToDismissValue) -> SwipeToDismissState
Selects the initial anchor before mounting the state.
Sourcepub fn positional_threshold(
self,
threshold: impl Fn(Pixels) -> Pixels + 'static,
) -> SwipeToDismissState
pub fn positional_threshold( self, threshold: impl Fn(Pixels) -> Pixels + 'static, ) -> SwipeToDismissState
Computes the release threshold from the current width in logical pixels. The default is 56 logical pixels, limited by the available travel.
Sourcepub fn current_value(&self) -> SwipeToDismissValue
pub fn current_value(&self) -> SwipeToDismissValue
Returns the nearest anchor to the current foreground position.
Sourcepub fn target_value(&self) -> SwipeToDismissValue
pub fn target_value(&self) -> SwipeToDismissValue
Returns the anchor where the current interaction would land.
Sourcepub fn settled_value(&self) -> SwipeToDismissValue
pub fn settled_value(&self) -> SwipeToDismissValue
Returns the last fully reached anchor.
Sourcepub fn dismiss_direction(&self) -> SwipeToDismissValue
pub fn dismiss_direction(&self) -> SwipeToDismissValue
Returns the logical direction of the current offset.
Sourcepub fn dismiss(
&mut self,
direction: SwipeToDismissValue,
window: &mut Window,
cx: &mut Context<'_, SwipeToDismissState>,
) -> bool
pub fn dismiss( &mut self, direction: SwipeToDismissValue, window: &mut Window, cx: &mut Context<'_, SwipeToDismissState>, ) -> bool
Animates to an enabled dismissal direction. Returns whether it was accepted.
Sourcepub fn reset(
&mut self,
window: &mut Window,
cx: &mut Context<'_, SwipeToDismissState>,
)
pub fn reset( &mut self, window: &mut Window, cx: &mut Context<'_, SwipeToDismissState>, )
Animates the foreground back to its resting position.
Sourcepub fn snap_to(
&mut self,
value: SwipeToDismissValue,
window: &mut Window,
cx: &mut Context<'_, SwipeToDismissState>,
) -> bool
pub fn snap_to( &mut self, value: SwipeToDismissValue, window: &mut Window, cx: &mut Context<'_, SwipeToDismissState>, ) -> bool
Moves immediately to an enabled anchor. Returns whether it was accepted.
Trait Implementations§
Source§impl Default for SwipeToDismissState
impl Default for SwipeToDismissState
Source§fn default() -> SwipeToDismissState
fn default() -> SwipeToDismissState
Returns the “default value” for a type. Read more
impl EventEmitter<Dismissed> for SwipeToDismissState
Auto Trait Implementations§
impl !RefUnwindSafe for SwipeToDismissState
impl !Send for SwipeToDismissState
impl !Sync for SwipeToDismissState
impl !UnwindSafe for SwipeToDismissState
impl Forget for SwipeToDismissState
impl Freeze for SwipeToDismissState
impl Move for SwipeToDismissState
impl Unpin for SwipeToDismissState
impl UnsafeUnpin for SwipeToDismissState
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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> ⓘ
Converts
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> ⓘ
Converts
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian().