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: boolMakes 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: boolMakes 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: ScrollbarHow 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: OverscrollWhether 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: f32The 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: f32Blur 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
impl InteractSpec
Sourcepub const EMPTY: InteractSpec
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
impl Clone for InteractSpec
Source§fn clone(&self) -> InteractSpec
fn clone(&self) -> InteractSpec
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for InteractSpec
impl Debug for InteractSpec
Source§impl Default for InteractSpec
impl Default for InteractSpec
Source§fn default() -> InteractSpec
fn default() -> InteractSpec
Source§impl PartialEq for InteractSpec
impl PartialEq for InteractSpec
impl StructuralPartialEq for InteractSpec
Auto Trait Implementations§
impl Freeze for InteractSpec
impl RefUnwindSafe for InteractSpec
impl Send for InteractSpec
impl Sync for InteractSpec
impl Unpin for InteractSpec
impl UnsafeUnpin for InteractSpec
impl UnwindSafe for InteractSpec
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<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.