Skip to main content

InteractionSession

Struct InteractionSession 

Source
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: String

ID of the item being interacted with.

§interaction_type: InteractionType

Whether 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: ResizeHandle

The resize handle being used (only relevant for Resize).

§col_width_px: f32

Current rendered width of a single column in pixels.

§row_height_px: f32

Current 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: CompactionType

The compaction strategy to apply during the interaction.

§collision: CollisionStrategy

Collision handling during the interaction (usually CollisionStrategy::PushDown).

Implementations§

Source§

impl InteractionSession

Source

pub fn get_smooth_offset(&self, current_mouse: (f32, f32)) -> (f32, f32)

Returns the raw pixel displacement for smooth rendering

Source

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

Source

pub fn get_visual_rect(&self, current_mouse: (f32, f32)) -> (f32, f32, f32, f32)

Returns the continuous pixel-rect for rendering the active element. This prevents the ‘Snap-Flicker’ by using start_rect as the base instead of the current layout.

Source

pub fn get_visual_delta( &self, current_mouse: (f32, f32), ) -> (f32, f32, f32, f32)

Returns the pure mouse displacement delta (dx, dy, dw, dh) to be combined with native CSS calc() for frame-perfect rendering.

Trait Implementations§

Source§

impl Clone for InteractionSession

Source§

fn clone(&self) -> InteractionSession

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 InteractionSession

Source§

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

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

impl PartialEq for InteractionSession

Source§

fn eq(&self, other: &InteractionSession) -> 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 InteractionSession

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> 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.