pub struct DragState { /* private fields */ }Expand description
Runtime pointer state for handle-based dragging.
The helper intentionally stores only coordinates and item positions, never rendered GPUI elements. This mirrors the safe part of drag-rs’ model: a drag operation has a start point, a current cursor point and a result callback, while each UI renders its own preview/handle natively.
Implementations§
Source§impl DragState
impl DragState
pub fn start(&mut self, index: usize, position: Point<Pixels>)
pub fn start_at( &mut self, index: usize, position: Point<Pixels>, bounds: Option<Bounds<Pixels>>, )
pub fn update_position(&mut self, position: Point<Pixels>)
pub fn set_over(&mut self, index: usize)
pub fn move_active_to(&mut self, index: usize)
pub fn finish(&mut self) -> Option<(usize, usize)>
pub fn cancel(&mut self)
pub fn active_index(&self) -> Option<usize>
pub fn origin_index(&self) -> Option<usize>
pub fn over_index(&self) -> Option<usize>
pub fn is_active(&self, index: usize) -> bool
pub fn is_over(&self, index: usize) -> bool
pub fn offset(&self, axis: DragAxis) -> (Pixels, Pixels)
Sourcepub fn offset_from_bounds(
&self,
axis: DragAxis,
bounds: Option<Bounds<Pixels>>,
) -> (Pixels, Pixels)
pub fn offset_from_bounds( &self, axis: DragAxis, bounds: Option<Bounds<Pixels>>, ) -> (Pixels, Pixels)
Offset the active item from its current layout slot so the original grabbed point remains under the pointer.
Reorderable lists may move the active item to a new slot while the
pointer is still down. Using only current - start makes the item jump
when that layout slot changes. When the caller can provide the active
slot’s latest bounds, this method compensates by anchoring the visual
preview to the grab offset captured on mouse down.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DragState
impl RefUnwindSafe for DragState
impl Send for DragState
impl Sync for DragState
impl Unpin for DragState
impl UnsafeUnpin for DragState
impl UnwindSafe for DragState
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<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>
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 moreSource§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().