pub struct DragConfig {
pub threshold: f64,
pub animation_duration: Duration,
pub easing: Rc<dyn Easing>,
pub custom_data: Option<Rc<dyn Any>>,
pub track_targets: bool,
}Expand description
Configuration for draggable behavior and animations.
Fields§
§threshold: f64Minimum distance (in logical pixels) pointer must move before drag starts.
animation_duration: DurationDuration of the return animation when drag is released.
easing: Rc<dyn Easing>Easing function for the return animation.
custom_data: Option<Rc<dyn Any>>Optional custom data to pass through drag events
track_targets: boolIf true, track drop targets and emit DragTargetEvents (Enter/Move/Leave/Drop). If false, only emit DragSourceEvents (Start/Move/Drop/Cancel) - simpler state machine.
Implementations§
Source§impl DragConfig
impl DragConfig
Sourcepub fn new(
threshold: f64,
animation_duration: Duration,
easing: impl Easing + 'static,
) -> Self
pub fn new( threshold: f64, animation_duration: Duration, easing: impl Easing + 'static, ) -> Self
Create a new drag configuration with custom parameters.
Sourcepub fn with_threshold(self, threshold: f64) -> Self
pub fn with_threshold(self, threshold: f64) -> Self
Set the drag threshold distance.
Sourcepub fn with_animation_duration(self, duration: Duration) -> Self
pub fn with_animation_duration(self, duration: Duration) -> Self
Set the animation duration.
Sourcepub fn with_easing(self, easing: impl Easing + 'static) -> Self
pub fn with_easing(self, easing: impl Easing + 'static) -> Self
Set the easing function.
Sourcepub fn with_custom_data(self, data: impl Any + 'static) -> Self
pub fn with_custom_data(self, data: impl Any + 'static) -> Self
Attach custom data to pass through drag events.
Sourcepub fn with_track_targets(self, track_targets: bool) -> Self
pub fn with_track_targets(self, track_targets: bool) -> Self
Set whether to track drop targets.
When true (default), emits DragTargetEvents (Enter/Move/Leave/Drop) to elements
under the dragged element, and DragSourceEvents (Enter/Leave) when hovering targets.
When false, only emits DragSourceEvents (Start/Move/Drop/Cancel) - a simpler
state machine useful for pan/zoom, sliders, and custom drag interactions.
Trait Implementations§
Source§impl Clone for DragConfig
impl Clone for DragConfig
Source§fn clone(&self) -> DragConfig
fn clone(&self) -> DragConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DragConfig
impl Debug for DragConfig
Auto Trait Implementations§
impl Freeze for DragConfig
impl !RefUnwindSafe for DragConfig
impl !Send for DragConfig
impl !Sync for DragConfig
impl Unpin for DragConfig
impl UnsafeUnpin for DragConfig
impl !UnwindSafe for DragConfig
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,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
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§impl<T> Pointable for T
impl<T> Pointable for T
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>
ReadEndian::read_from_little_endian().