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.