pub struct DraggableState { /* private fields */ }Expand description
Re-export the UI crate so applications can depend on a single crate. Drag position and progress for one control.
Cloning shares the state, so a scope can hold a handle and the modifier can hold another without either owning the truth.
Implementations§
Source§impl DraggableState
impl DraggableState
Sourcepub fn new(on_delta: impl Fn(f32) + 'static) -> DraggableState
pub fn new(on_delta: impl Fn(f32) + 'static) -> DraggableState
Creates a drag state delivering deltas to on_delta.
Prefer rememberDraggableState inside a composition; this is for
callers that own the state themselves.
Sourcepub fn update_handler(&self, on_delta: impl Fn(f32) + 'static)
pub fn update_handler(&self, on_delta: impl Fn(f32) + 'static)
Replaces the delta handler.
A composition calls this every recomposition so the handler closes over the current values rather than the ones the first composition captured.
Sourcepub fn is_dragging(&self) -> bool
pub fn is_dragging(&self) -> bool
Whether a drag is in flight. Reactive: a composable that reads it recomposes when the drag starts and when it ends, and not per frame in between.
Sourcepub fn dragging(&self) -> State<bool>
pub fn dragging(&self) -> State<bool>
is_dragging as a state a scope can hand around.
Trait Implementations§
Source§impl Clone for DraggableState
impl Clone for DraggableState
Source§fn clone(&self) -> DraggableState
fn clone(&self) -> DraggableState
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for DraggableState
impl !Send for DraggableState
impl !Sync for DraggableState
impl !UnwindSafe for DraggableState
impl Freeze for DraggableState
impl Unpin for DraggableState
impl UnsafeUnpin for DraggableState
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.