Skip to main content

Sense

Struct Sense 

Source
pub struct Sense {
    pub click: bool,
    pub drag: bool,
    pub hover: bool,
    pub focus: bool,
}
Expand description

What interactions a widget is sensitive to

Using CLICK_AND_DRAG introduces latency to distinguish click vs drag intent.

Fields§

§click: bool

Widget responds to clicks

§drag: bool

Widget responds to drags

§hover: bool

Widget tracks hover state

§focus: bool

Widget can receive keyboard focus

Implementations§

Source§

impl Sense

Source

pub const NONE: Sense

No interactions at all

Source

pub const HOVER: Sense

Only hover detection

Source

pub const CLICK: Sense

Click and hover (for buttons, checkboxes)

Source

pub const DRAG: Sense

Drag and hover (for sliders, scrollbars)

Source

pub const CLICK_AND_DRAG: Sense

Both click and drag (introduces latency)

Source

pub const FOCUSABLE: Sense

Can receive keyboard focus but no mouse interaction

Source

pub const ALL: Sense

Full interaction - click, drag, hover, focus

Source§

impl Sense

Source

pub fn none() -> Self

Create empty sense (no interactions)

Source

pub fn hover() -> Self

Create hover-only sense

Source

pub fn click() -> Self

Create click sense (includes hover)

Source

pub fn drag() -> Self

Create drag sense (includes hover)

Source

pub fn click_and_drag() -> Self

Create click and drag sense (includes hover, introduces latency)

Source

pub fn focusable() -> Self

Create focusable sense (for keyboard navigation)

Source

pub fn all() -> Self

Create full interaction sense

Source§

impl Sense

Source

pub fn union(self, other: Sense) -> Sense

Union of two senses (OR)

Source

pub fn intersection(self, other: Sense) -> Sense

Intersection of two senses (AND)

Source

pub fn with_click(self) -> Self

Add click sensing (also adds hover)

Source

pub fn with_drag(self) -> Self

Add drag sensing (also adds hover)

Source

pub fn with_focus(self) -> Self

Add focus capability

Source§

impl Sense

Source

pub fn interactive(&self) -> bool

Check if any interaction is sensed (click, drag, or focus)

Source

pub fn has_click_and_drag(&self) -> bool

Check if both click and drag are sensed (has latency)

Source

pub fn is_passive(&self) -> bool

Check if widget is purely visual (no interactions)

Trait Implementations§

Source§

impl BitOr for Sense

Source§

fn bitor(self, rhs: Self) -> Self::Output

Combine two senses using the | operator (equivalent to union)

Source§

type Output = Sense

The resulting type after applying the | operator.
Source§

impl BitOrAssign for Sense

Source§

fn bitor_assign(&mut self, rhs: Self)

Combine this sense with another using |=

Source§

impl Clone for Sense

Source§

fn clone(&self) -> Sense

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 Sense

Source§

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

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

impl Default for Sense

Source§

fn default() -> Sense

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

impl Hash for Sense

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Sense

Source§

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

Source§

impl Eq for Sense

Source§

impl StructuralPartialEq for Sense

Auto Trait Implementations§

§

impl Freeze for Sense

§

impl RefUnwindSafe for Sense

§

impl Send for Sense

§

impl Sync for Sense

§

impl Unpin for Sense

§

impl UnsafeUnpin for Sense

§

impl UnwindSafe for Sense

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.