Skip to main content

Module floating_surface

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.
ControlBar
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_inset inside it so the buttons’ corners run concentric with the panel’s, s1 between 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§

PanelAlign
Which edge of its anchor a floating Panel lines up with on the cross axis.
PopoverSide
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 side of anchor, gap away, inside viewport: 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 s2 step. 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). row is the row already inset by inset from the panel’s edge (menu_inset for a menu built on it). Returns the ink for the row’s label and glyphs.
paint_armed_row_in
paint_armed_row inside a panel of panel_radius (a single-row menu’s single_row_radius).
paint_rounded
paint with an explicit corner radius (a single-row menu’s single_row_radius).
painted_bounds
Every pixel a floating Panel in rect paints, its shadow included: what a host repaints where one appears, changes or goes. Tighter than shadow_reach on 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: window less the viewport_margin on every side.
place_aligned
place_anchored with the cross-axis edge it lines up with: a panel aligned PanelAlign::Trailing hangs 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 size goes against anchor (the control that opened it, or a zero-size pointer position) inside viewport: on side of the anchor, gap away, its leading edge on the anchor’s leading edge. It flips to the other side when side has 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 s2 step, the menu’s own inset, so a panel pushed against an edge keeps the same air as its rows.