pub struct OverlayPlacement {
pub side: OverlaySide,
pub align: OverlayAlign,
pub offset: f64,
pub flip: bool,
pub clamp: bool,
pub padding: f64,
}Expand description
The overlay-portal authoring surface: the slot a widget that floats its own surface holds, what that surface is anchored to, and the placement geometry every anchored pattern needs.
Promoted here rather than left to each design system because all three of
them had derived the same geometry independently: a design system’s popover,
menu, tooltip and context menu place a surface through place and host it
through OverlaySlot, reaching both through frust::authoring alone.
The overlay-portal authoring surface: the slot a widget that floats its own
surface holds, what that surface is anchored to, and the placement geometry
every anchored pattern needs.
Promoted here rather than left to each design system because all three of
them had derived the same geometry independently: a design system’s popover,
menu, tooltip and context menu place a surface through place and host it
through OverlaySlot, reaching both through frust::authoring alone.
The overlay-portal authoring surface: the slot a widget that floats its own
surface holds, what that surface is anchored to, and the placement geometry
every anchored pattern needs.
Promoted here rather than left to each design system because all three of
them had derived the same geometry independently: a design system’s popover,
menu, tooltip and context menu place a surface through place and host it
through OverlaySlot, reaching both through frust::authoring alone.
A resolved placement request: which side, how it lines up, how far off the
anchor it sits, and how it may move to stay inside the area.
Fields§
§side: OverlaySideThe preferred side.
align: OverlayAlignCross-axis alignment.
offset: f64Gap between the anchor and the surface, in logical px.
flip: boolFlip to OverlaySide::opposite when the preferred side does not fit
and the opposite one does.
clamp: boolShift the placed rect back inside the padded area when it overflows.
padding: f64The margin the surface keeps from every edge of the area, in logical px. Both the fit test and the clamp read the area inset by it.
Implementations§
Source§impl OverlayPlacement
impl OverlayPlacement
Sourcepub fn on(side: OverlaySide) -> Self
pub fn on(side: OverlaySide) -> Self
A placement on side, everything else defaulted.
Sourcepub const fn align(self, align: OverlayAlign) -> Self
pub const fn align(self, align: OverlayAlign) -> Self
Set the cross-axis alignment.
Trait Implementations§
Source§impl Clone for OverlayPlacement
impl Clone for OverlayPlacement
impl Copy for OverlayPlacement
Source§impl Debug for OverlayPlacement
impl Debug for OverlayPlacement
Source§impl Default for OverlayPlacement
impl Default for OverlayPlacement
Source§fn default() -> Self
fn default() -> Self
Below the anchor, centred, at DEFAULT_OFFSET, flipping and clamping
inside DEFAULT_PADDING of the area’s edges.