Skip to main content

WidgetInputState

Struct WidgetInputState 

Source
pub struct WidgetInputState {
    pub focus: FocusState,
    pub hover: HoverState,
    pub drag: DragState,
    pub active: Option<WidgetId>,
    pub last_click_time: f64,
    pub last_click_pos: (f64, f64),
    pub last_click_widget: Option<WidgetId>,
    pub double_click_threshold_ms: f64,
    pub double_click_distance: f64,
    pub click_count: u8,
    pub triple_click_threshold_ms: f64,
}
Expand description

Combined widget input state

Fields§

§focus: FocusState

Focus management

§hover: HoverState

Hover tracking

§drag: DragState

Drag tracking

§active: Option<WidgetId>

Active widget (pressed but not yet released)

§last_click_time: f64

Last click time for double-click detection

§last_click_pos: (f64, f64)

Last click position

§last_click_widget: Option<WidgetId>

Last clicked widget

§double_click_threshold_ms: f64

Double-click threshold in milliseconds

§double_click_distance: f64

Double-click distance threshold in pixels

§click_count: u8

Click count for multi-click detection (1 = single, 2 = double, 3 = triple)

§triple_click_threshold_ms: f64

Triple-click threshold in milliseconds

Implementations§

Source§

impl WidgetInputState

Source

pub fn new() -> Self

Source

pub fn update_mouse(&mut self, x: f64, y: f64)

Update mouse position

Source

pub fn mouse_press(&mut self, _x: f64, _y: f64, widget_id: Option<WidgetId>)

Handle mouse press

Source

pub fn mouse_release(&mut self, x: f64, y: f64, now: f64) -> WidgetInteraction

Handle mouse release with click/double-click/triple-click detection

Source

pub fn start_drag(&mut self, id: WidgetId, x: f64, y: f64)

Start dragging a widget

Source

pub fn start_drag_with_value( &mut self, id: WidgetId, x: f64, y: f64, value: f64, )

Start dragging with value (for sliders)

Source

pub fn end_frame(&mut self)

Process frame end (update pending states)

Trait Implementations§

Source§

impl Clone for WidgetInputState

Source§

fn clone(&self) -> WidgetInputState

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 WidgetInputState

Source§

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

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

impl Default for WidgetInputState

Source§

fn default() -> WidgetInputState

Returns the “default value” for a type. Read more

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.