Skip to main content

DragContext

Struct DragContext 

Source
pub struct DragContext {
    pub drag_type: ActiveDragType,
    pub session_id: u64,
    pub cancelled: bool,
}
Expand description

The unified drag context.

This struct wraps ActiveDragType and provides common metadata that applies to all drag operations.

Fields§

§drag_type: ActiveDragType

The specific type of drag operation

§session_id: u64

Session ID from gesture detection (links back to GestureManager)

§cancelled: bool

Whether the drag has been cancelled (e.g., Escape pressed)

Implementations§

Source§

impl DragContext

Source

pub fn new(drag_type: ActiveDragType, session_id: u64) -> Self

Create a new drag context

Source

pub fn text_selection( dom_id: DomId, anchor_ifc_node: NodeId, start_mouse_position: LogicalPosition, session_id: u64, ) -> Self

Create a text selection drag

Source

pub fn scrollbar_thumb( scroll_container_node: NodeId, axis: ScrollbarAxis, start_mouse_position: LogicalPosition, start_scroll_offset: f32, track_length_px: f32, content_length_px: f32, viewport_length_px: f32, session_id: u64, ) -> Self

Create a scrollbar thumb drag

Source

pub fn node_drag( dom_id: DomId, node_id: NodeId, start_position: LogicalPosition, drag_data: DragData, session_id: u64, ) -> Self

Create a node drag

Source

pub fn window_move( start_position: LogicalPosition, initial_window_position: WindowPosition, session_id: u64, ) -> Self

Create a window move drag

Source

pub fn file_drop( files: Vec<AzString>, position: LogicalPosition, session_id: u64, ) -> Self

Create a file drop drag

Source

pub fn update_position(&mut self, position: LogicalPosition)

Update the current mouse position for all drag types

Source

pub fn current_position(&self) -> LogicalPosition

Get the current mouse position

Source

pub fn start_position(&self) -> LogicalPosition

Get the start position

Source

pub fn is_text_selection(&self) -> bool

Check if this is a text selection drag

Source

pub fn is_scrollbar_thumb(&self) -> bool

Check if this is a scrollbar thumb drag

Source

pub fn is_node_drag(&self) -> bool

Check if this is a node drag

Source

pub fn is_window_move(&self) -> bool

Check if this is a window move drag

Source

pub fn is_file_drop(&self) -> bool

Check if this is a file drop

Source

pub fn as_text_selection(&self) -> Option<&TextSelectionDrag>

Get as text selection drag (if applicable)

Source

pub fn as_text_selection_mut(&mut self) -> Option<&mut TextSelectionDrag>

Get as mutable text selection drag (if applicable)

Source

pub fn as_scrollbar_thumb(&self) -> Option<&ScrollbarThumbDrag>

Get as scrollbar thumb drag (if applicable)

Source

pub fn as_scrollbar_thumb_mut(&mut self) -> Option<&mut ScrollbarThumbDrag>

Get as mutable scrollbar thumb drag (if applicable)

Source

pub fn as_node_drag(&self) -> Option<&NodeDrag>

Get as node drag (if applicable)

Source

pub fn as_node_drag_mut(&mut self) -> Option<&mut NodeDrag>

Get as mutable node drag (if applicable)

Source

pub fn as_window_move(&self) -> Option<&WindowMoveDrag>

Get as window move drag (if applicable)

Source

pub fn as_file_drop(&self) -> Option<&FileDropDrag>

Get as file drop (if applicable)

Source

pub fn as_file_drop_mut(&mut self) -> Option<&mut FileDropDrag>

Get as mutable file drop (if applicable)

Source

pub fn calculate_scrollbar_scroll_offset(&self) -> Option<f32>

Calculate scroll delta for scrollbar thumb drag

Returns the new scroll offset based on current mouse position.

Source

pub fn remap_node_ids( &mut self, dom_id: DomId, node_id_map: &BTreeMap<NodeId, NodeId>, ) -> bool

Remap NodeIds stored in this drag context after DOM reconciliation.

When the DOM is regenerated during an active drag, NodeIds can change. This updates all stored NodeIds using the old→new mapping. Returns false if a critical NodeId was removed (drag should be cancelled).

Trait Implementations§

Source§

impl Clone for DragContext

Source§

fn clone(&self) -> DragContext

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DragContext

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for DragContext

Source§

fn eq(&self, other: &DragContext) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for DragContext

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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 more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.