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.
OVERLAY_LIFT_LIGHT
OVERLAY_LIFT on a light material, whose lift step is smaller.

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.
card_ground
A floating card’s ground (card_radius): the panel ground.
card_radius
The one floating card: a notification banner, a toast, the command palette, a desk widget’s card, the frame around an app’s call or navigation card. It is the floating Panel’s shape (its radius, capped for a card shorter than two corners) on an opaque ground: the panel ground, the derived panel edge and, on a dark material, the inner light edge, lifted by the floating elevation. Nothing behind a card reads through it; translucency belongs to scrims.
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.
on_device_pixels
rect with its edges on the device pixels the frame draws on: a panel placed against a measured label width or a rounded row would otherwise stand between two pixels and be painted soft across both. Its leading edges round out and its trailing edges up, so a snap never takes room from a row.
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_card
Paint a whole floating card: its shadow and body.
paint_card_body
Paint a floating card’s body without its shadow: the opaque ground and its edges. A host that fades or moves the shadow on its own paints it with paint_card_shadow.
paint_card_body_with
paint_card_body on another opaque ground: an app’s own content ground inside the card’s frame.
paint_card_edge
A floating card’s edge, drawn over its content: the inner hairline.
paint_card_shadow
Paint a floating card’s shadow, alpha of its strength (a card that is still arriving).
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.
place_sheet_beside
Where a sheet of size that asks about the control at anchor stands: under it where there is room (else over it), gap from it, inside window and within room vertically.
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.