Module floating_surface
Expand description
The one body of every floating Panel: popovers, menus, modal sheets and toasts.
A floating Panel is the panel radius (radii.panel), the blurred
material with its opaque fallback, the derived panel edge plus the 1 px
inner light edge on a dark material, and one soft shadow
(elevation.floating). The overlays differ in placement and
interaction; they never differ in this.
Structs§
- BarControl
- One control of a
ControlBar: an icon button over media, named for assistive technology and its tooltip. - Control
Bar - The floating bar of controls over media (a camera’s capture controls, a
player’s transport): one floating Panel shaped to a row of Regular icon
buttons,
control_insetinside it so the buttons’ corners run concentric with the panel’s,s1between them. It owns the panel, the gaps, the hover and press faces and the hit rects; the host says which controls stand in it and where, and acts on the index it reports.
Enums§
- Panel
Align - Which edge of its anchor a floating Panel lines up with on the cross axis.
- Popover
Side - Which side of its anchor a floating Panel opens on.
Constants§
- OVERLAY_
LIFT - How many surface steps the armed row of a menu stands off its panel.
Functions§
- anchored_
room - The room a Panel has on
sideofanchor,gapaway, insideviewport: the most a menu opening there can grow before it scrolls. - armed_
row - The fill of a menu’s armed row (the row Enter or a click activates) and
the ink on it: the panel ground’s overlay lift (
OVERLAY_LIFT) with primary ink measured on it. Hue-free under the default emphasis. - control_
inset - The inset of a control inside a floating Panel that holds a row of controls (a media control bar, a prompt): the panel radius less the control radius, so the control’s corners run concentric with the panel’s.
- menu_
inset - How far a menu’s rows sit inside its Panel, on every side: the
s2step. Popover menus, dropdown lists and context menus share it, so the armed row’s corners run concentric with the panel in all of them. - paint
- Paint a floating Panel’s body in
rect: shadow, material, edge. Content is drawn on top by the caller. - paint_
armed_ row - Paint the armed row of a menu: the overlay lift of
armed_row, concentric inside the panel (HIG §9.3).rowis the row already inset byinsetfrom the panel’s edge (menu_insetfor a menu built on it). Returns the ink for the row’s label and glyphs. - paint_
armed_ row_ in paint_armed_rowinside a panel ofpanel_radius(a single-row menu’ssingle_row_radius).- paint_
rounded paintwith an explicit cornerradius(a single-row menu’ssingle_row_radius).- painted_
bounds - Every pixel a floating Panel in
rectpaints, its shadow included: what a host repaints where one appears, changes or goes. Tighter thanshadow_reachon every side, as it follows the shadow’s real kernel and offset (crate::surface::shadow_bounds). - panel_
room - The room an anchored floating Panel is placed in:
windowless theviewport_marginon every side. - place_
aligned place_anchoredwith the cross-axis edge it lines up with: a panel alignedPanelAlign::Trailinghangs from the anchor’s trailing edge and flips to the leading edge only when it would run past the viewport’s leading edge.- place_
anchored - Where a floating Panel of
sizegoes againstanchor(the control that opened it, or a zero-size pointer position) insideviewport: onsideof the anchor,gapaway, its leading edge on the anchor’s leading edge. It flips to the other side whensidehas no room and the other side has more, flips its alignment to the anchor’s trailing edge when it would run past the viewport’s trailing edge, and then shifts along the anchor into the viewport. Returns the panel and the side it opened on. - radius
- The corner radius of a floating Panel.
- shadow_
reach - How far a floating Panel’s shadow reaches past its rect on any side: what a host repaints around a panel that appears, moves or changes.
- single_
row_ radius - The radius of a menu panel holding a single row: the row’s item radius plus the menu inset, concentric with the row, so one row never sits in a near-pill.
- viewport_
margin - How far every anchored floating Panel (popovers, menus, dropdown lists)
stays from the window’s edges: the
s2step, the menu’s own inset, so a panel pushed against an edge keeps the same air as its rows.