pub struct InteractionState {
pub hovered: bool,
pub focused: bool,
pub pressed: bool,
pub dragged: bool,
}Expand description
Tracks a widget’s hover/focus/pressed/dragged interaction state. See the module docs for the two opacity resolvers this feeds.
Fields§
§hovered: bool§focused: bool§pressed: bool§dragged: boolImplementations§
Source§impl InteractionState
impl InteractionState
Sourcepub fn set_hovered(&mut self, hovered: bool) -> bool
pub fn set_hovered(&mut self, hovered: bool) -> bool
Record the widget’s hover state. Returns whether the flag changed —
the frame source for hover gain per docs/CODE_STANDARDS.md’s
Interaction Semantics hover-claiming seam (claim_hover itself
requests no redraw).
Sourcepub fn set_focused(&mut self, focused: bool) -> bool
pub fn set_focused(&mut self, focused: bool) -> bool
Record the widget’s focus state. Returns whether the flag changed.
Sourcepub fn set_pressed(&mut self, pressed: bool) -> bool
pub fn set_pressed(&mut self, pressed: bool) -> bool
Record the widget’s pressed state. Returns whether the flag changed.
Sourcepub fn set_dragged(&mut self, dragged: bool) -> bool
pub fn set_dragged(&mut self, dragged: bool) -> bool
Record the widget’s dragged state. Returns whether the flag changed.
Sourcepub fn resolve_opacity(&self) -> f32
pub fn resolve_opacity(&self) -> f32
The M3E-precedence overlay opacity: dragged > pressed > focused > hovered — the single highest-priority active state’s opacity, or
0.0 if none are active. The new documented default; see the
module docs for how this differs from
Self::max_active_opacity.
Sourcepub fn max_active_opacity(&self) -> f32
pub fn max_active_opacity(&self) -> f32
The maximum of every active state’s opacity —
crate::state_layer::StateLayer’s original resolver, kept for its
back-compat contract. See the module docs.
Trait Implementations§
Source§impl Clone for InteractionState
impl Clone for InteractionState
impl Copy for InteractionState
Source§impl Debug for InteractionState
impl Debug for InteractionState
Source§impl Default for InteractionState
impl Default for InteractionState
Source§impl PartialEq for InteractionState
impl PartialEq for InteractionState
impl StructuralPartialEq for InteractionState
Auto Trait Implementations§
impl Freeze for InteractionState
impl RefUnwindSafe for InteractionState
impl Send for InteractionState
impl Sync for InteractionState
impl Unpin for InteractionState
impl UnsafeUnpin for InteractionState
impl UnwindSafe for InteractionState
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
impl<T> Brush for T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.