pub struct InteractionSession {
pub id: String,
pub interaction_type: InteractionType,
pub start_mouse: (f32, f32),
pub start_rect: (i32, i32, i32, i32),
pub handle: ResizeHandle,
pub col_width_px: f32,
pub row_height_px: f32,
pub margin: (i32, i32),
pub container_padding: (i32, i32),
pub compaction: CompactionType,
pub collision: CollisionStrategy,
}Expand description
Captures the state of an active drag or resize operation. This struct handles the high-frequency sub-pixel tracking and periodic grid snapping logic.
Fields§
§id: StringID of the item being interacted with.
interaction_type: InteractionTypeWhether this is a drag or resize.
start_mouse: (f32, f32)Initial mouse coordinates (X, Y) when the interaction started.
start_rect: (i32, i32, i32, i32)Initial position and dimensions (X, Y, W, H) in grid units.
handle: ResizeHandleThe resize handle being used (only relevant for Resize).
col_width_px: f32Current rendered width of a single column in pixels.
row_height_px: f32Current rendered height of a single row in pixels.
margin: (i32, i32)Margin between items (X, Y) in pixels.
container_padding: (i32, i32)Padding inside the container around the grid content (left, top), in px.
Added to Self::get_visual_rect output; pointer deltas remain unchanged.
compaction: CompactionTypeThe compaction strategy to apply during the interaction.
collision: CollisionStrategyCollision handling during the interaction (usually CollisionStrategy::PushDown).
Implementations§
Source§impl InteractionSession
impl InteractionSession
Sourcepub fn get_smooth_offset(&self, current_mouse: (f32, f32)) -> (f32, f32)
pub fn get_smooth_offset(&self, current_mouse: (f32, f32)) -> (f32, f32)
Returns the raw pixel displacement for smooth rendering
Sourcepub fn update(
&self,
current_mouse: (f32, f32),
layout: &mut Vec<LayoutItem>,
cols: i32,
)
pub fn update( &self, current_mouse: (f32, f32), layout: &mut Vec<LayoutItem>, cols: i32, )
Performs a single-pass interaction update: Mouse Delta -> Handle-Aware Rect -> Grid Logic
Trait Implementations§
Source§impl Clone for InteractionSession
impl Clone for InteractionSession
Source§fn clone(&self) -> InteractionSession
fn clone(&self) -> InteractionSession
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more