Skip to main content

InteractSpec

Struct InteractSpec 

Source
pub struct InteractSpec {
Show 15 fields pub hover_bg: Option<Color>, pub pressed_bg: Option<Color>, pub hover_group: Option<u64>, pub click_sound: Option<SoundId>, pub hover_sound: Option<SoundId>, pub focus_bg: Option<Color>, pub drop_bg: Option<Color>, pub selectable: bool, pub focus_region: bool, pub scrollbar: Scrollbar, pub overscroll: Overscroll, pub rules: Option<Color>, pub rule_w: f32, pub gradient: Option<Gradient>, pub backdrop_blur: f32,
}
Expand description

Hover / pressed / focus styling and the sounds that go with them. Boxed on NodeSpec so the common node — which declares none of it — costs one null check in resolve_hover_style instead of reading several Options spread across the struct.

Fields§

§hover_bg: Option<Color>

Background while the pointer hovers this node (or any node sharing its hover_group). Resolved by the core when the node opens, so a data-only view gets hover styling without querying is_hovered — and with transition the swap eases. Implies hover tracking.

§pressed_bg: Option<Color>

Background while this node (or its group) is pressed. Implies hover tracking. Without a hover_bg, hover keeps the plain bg. An on_drag node holds this state for the whole captured drag, even while the cursor is off it.

§hover_group: Option<u64>

Hover group: nodes sharing an id count as one for hover_bg / pressed_bg — a two-piece elbow, a split button, a row whose cells highlight together. The id is a hash of a name (hover_group). Implies hover tracking.

§click_sound: Option<SoundId>

A registered sound played when this node is clicked (see crate::audio); the click itself still emits on_click if one is declared. Implies hover tracking.

§hover_sound: Option<SoundId>

A registered sound played when the pointer enters this node. Implies hover tracking.

§focus_bg: Option<Color>

Background while this node holds keyboard-visible focus (focus moved by Tab or by assistive technology, not by a click). Declaring one replaces the ring the core draws by default. Pressed wins over focus wins over hover; eases with transition.

§drop_bg: Option<Color>

Background while files dragged in from the OS are over this node. Wins over pressed, focus and hover — a press cannot be held while the OS holds a drag — and eases with transition; clears when the files leave, land or the drag is cancelled. Implies hover tracking.

§selectable: bool

Makes this node a selection scope: the text of every node inside it is one selectable run of text, in tree order, and a press-drag inside it selects across all of them. Declared on the container rather than on each label, because what a reader selects is a paragraph or a card, not one run of it.

Scopes do not nest: the innermost one containing a run owns it, and an outer one is warned about (nested-selection-scope). An edit is already its own scope and ignores this.

§focus_region: bool

Makes this node’s subtree a focus region: a Tab ring of its own that the ring outside never enters, and that never leaves — a devtools dock, an inspector beside the app. Entered on purpose: Ui::focus_region, a press inside it, or an explicit focus on a node in it. Nothing else about the node changes — it lays out, paints, takes the pointer and appears in the access tree as before, and keys bubble through it to the sink above.

§scrollbar: Scrollbar

How this node’s scrollbars look, when it scrolls (see Scrollbar). Cold: read once per scroller when its layer’s chrome is emitted, which is why it lives in this box rather than beside scroll_y on every node.

§overscroll: Overscroll

Whether a scroll gesture that starts over this scroller while it is at its limit that way goes on to the scroller around it (see Overscroll). Cold like scrollbar: read once per scroller a gesture starts over.

§rules: Option<Color>

On a table: lines of this colour between its columns and between its rows, drawn with the table’s own box, under its cells, down the middle of each gap, so a table with a gap of at least rule_w gets a grid with no rule cells. The columns come from the row with the most cells; the lines run the table’s content box. Ignored on anything that is not a table.

§rule_w: f32

The rules’ width in logical px; 0 is 1.

§gradient: Option<Gradient>

A gradient painted over the node’s bg and under its border and its children (docs/adr/0042-a-gradient-is-an-image-the-core-paints.md): one image quad from the atlas, rounded by the node’s radius. It does not tween, and the state backgrounds replace bg, not it.

§backdrop_blur: f32

Blur what the app drew beneath this node, inside its rounded rect, by this radius in logical px — CSS’s backdrop-filter: blur() (backlog F129). The blurred pixels are what was painted before the node (earlier siblings, ancestors, the window’s backdrop), never the node’s own bg or children, which paint over them; give it a translucent bg for frosted glass. Clipped as the node is; faded by its group opacity. 0 is none. A renderer with no way to read back its frame (the CPU raster) draws the node unblurred.

Implementations§

Source§

impl InteractSpec

Source

pub const EMPTY: InteractSpec

The group as a node that declares none of it — what NodeSpec’s accessor hands back when the box is None.

Trait Implementations§

Source§

impl Clone for InteractSpec

Source§

fn clone(&self) -> InteractSpec

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for InteractSpec

Source§

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

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

impl Default for InteractSpec

Source§

fn default() -> InteractSpec

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

impl PartialEq for InteractSpec

Source§

fn eq(&self, other: &InteractSpec) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for InteractSpec

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

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

Convert 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)

Convert &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)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send> ⓘ

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<S> FromSample<S> for S

Source§

fn from_sample_(s: S) -> S

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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<F, T> IntoSample<T> for F
where T: FromSample<F>,

Source§

fn into_sample(self) -> T

Source§

impl<T> NoneValue for T
where T: Default,

Source§

type NoneType = T

Source§

fn null_value() -> T

The none-equivalent value.
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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> ToSample<U> for T
where U: FromSample<T>,

Source§

fn to_sample_(self) -> U

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more