pub struct UnifiedDragContext {
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: ActiveDragTypeThe specific type of drag operation
session_id: u64Session ID from gesture detection (links back to GestureManager)
cancelled: boolWhether the drag has been cancelled (e.g., Escape pressed)
Implementations§
Source§impl DragContext
impl DragContext
Sourcepub fn new(drag_type: ActiveDragType, session_id: u64) -> DragContext
pub fn new(drag_type: ActiveDragType, session_id: u64) -> DragContext
Create a new drag context
Sourcepub fn text_selection(
dom_id: DomId,
anchor_ifc_node: NodeId,
start_mouse_position: LogicalPosition,
session_id: u64,
) -> DragContext
pub fn text_selection( dom_id: DomId, anchor_ifc_node: NodeId, start_mouse_position: LogicalPosition, session_id: u64, ) -> DragContext
Create a text selection drag
Sourcepub 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,
) -> DragContext
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, ) -> DragContext
Create a scrollbar thumb drag
Sourcepub fn node_drag(
dom_id: DomId,
node_id: NodeId,
start_position: LogicalPosition,
drag_data: DragData,
session_id: u64,
) -> DragContext
pub fn node_drag( dom_id: DomId, node_id: NodeId, start_position: LogicalPosition, drag_data: DragData, session_id: u64, ) -> DragContext
Create a node drag
Sourcepub fn window_move(
start_position: LogicalPosition,
initial_window_position: WindowPosition,
session_id: u64,
) -> DragContext
pub fn window_move( start_position: LogicalPosition, initial_window_position: WindowPosition, session_id: u64, ) -> DragContext
Create a window move drag
Sourcepub fn file_drop(
files: Vec<AzString>,
position: LogicalPosition,
session_id: u64,
) -> DragContext
pub fn file_drop( files: Vec<AzString>, position: LogicalPosition, session_id: u64, ) -> DragContext
Create a file drop drag
Sourcepub fn update_position(&mut self, position: LogicalPosition)
pub fn update_position(&mut self, position: LogicalPosition)
Update the current mouse position for all drag types
Sourcepub fn current_position(&self) -> LogicalPosition
pub fn current_position(&self) -> LogicalPosition
Get the current mouse position
Sourcepub fn start_position(&self) -> LogicalPosition
pub fn start_position(&self) -> LogicalPosition
Get the start position
Sourcepub fn is_text_selection(&self) -> bool
pub fn is_text_selection(&self) -> bool
Check if this is a text selection drag
Sourcepub fn is_scrollbar_thumb(&self) -> bool
pub fn is_scrollbar_thumb(&self) -> bool
Check if this is a scrollbar thumb drag
Sourcepub fn is_node_drag(&self) -> bool
pub fn is_node_drag(&self) -> bool
Check if this is a node drag
Sourcepub fn is_window_move(&self) -> bool
pub fn is_window_move(&self) -> bool
Check if this is a window move drag
Sourcepub fn is_file_drop(&self) -> bool
pub fn is_file_drop(&self) -> bool
Check if this is a file drop
Sourcepub fn as_text_selection(&self) -> Option<&TextSelectionDrag>
pub fn as_text_selection(&self) -> Option<&TextSelectionDrag>
Get as text selection drag (if applicable)
Sourcepub fn as_text_selection_mut(&mut self) -> Option<&mut TextSelectionDrag>
pub fn as_text_selection_mut(&mut self) -> Option<&mut TextSelectionDrag>
Get as mutable text selection drag (if applicable)
Sourcepub fn as_scrollbar_thumb(&self) -> Option<&ScrollbarThumbDrag>
pub fn as_scrollbar_thumb(&self) -> Option<&ScrollbarThumbDrag>
Get as scrollbar thumb drag (if applicable)
Sourcepub fn as_scrollbar_thumb_mut(&mut self) -> Option<&mut ScrollbarThumbDrag>
pub fn as_scrollbar_thumb_mut(&mut self) -> Option<&mut ScrollbarThumbDrag>
Get as mutable scrollbar thumb drag (if applicable)
Sourcepub fn as_node_drag(&self) -> Option<&NodeDrag>
pub fn as_node_drag(&self) -> Option<&NodeDrag>
Get as node drag (if applicable)
Sourcepub fn as_node_drag_mut(&mut self) -> Option<&mut NodeDrag>
pub fn as_node_drag_mut(&mut self) -> Option<&mut NodeDrag>
Get as mutable node drag (if applicable)
Sourcepub fn as_window_move(&self) -> Option<&WindowMoveDrag>
pub fn as_window_move(&self) -> Option<&WindowMoveDrag>
Get as window move drag (if applicable)
Sourcepub fn as_file_drop(&self) -> Option<&FileDropDrag>
pub fn as_file_drop(&self) -> Option<&FileDropDrag>
Get as file drop (if applicable)
Sourcepub fn as_file_drop_mut(&mut self) -> Option<&mut FileDropDrag>
pub fn as_file_drop_mut(&mut self) -> Option<&mut FileDropDrag>
Get as mutable file drop (if applicable)
Sourcepub fn calculate_scrollbar_scroll_offset(&self) -> Option<f32>
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.
Trait Implementations§
Source§impl Clone for DragContext
impl Clone for DragContext
Source§fn clone(&self) -> DragContext
fn clone(&self) -> DragContext
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DragContext
impl Debug for DragContext
Source§impl PartialEq for DragContext
impl PartialEq for DragContext
impl StructuralPartialEq for DragContext
Auto Trait Implementations§
impl Freeze for DragContext
impl RefUnwindSafe for DragContext
impl Send for DragContext
impl Sync for DragContext
impl Unpin for DragContext
impl UnwindSafe for DragContext
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> 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