pub struct Positioning {
pub left: Option<f32>,
pub top: Option<f32>,
pub right: Option<f32>,
pub bottom: Option<f32>,
pub width: Option<f32>,
pub height: Option<f32>,
}Expand description
What a Positioned pins, in logical pixels from the stack’s edges. None on an
edge means “not pinned there”.
Fields§
§left: Option<f32>The distance from the stack’s left edge, or None to leave that edge free.
top: Option<f32>The distance from the stack’s top edge, or None to leave that edge free.
right: Option<f32>The distance from the stack’s right edge, or None to leave that edge free.
bottom: Option<f32>The distance from the stack’s bottom edge, or None to leave that edge free.
width: Option<f32>A fixed width, or None to take the one the edges and the content leave.
height: Option<f32>A fixed height, or None to take the one the edges and the content leave.
Implementations§
Source§impl Positioning
impl Positioning
Sourcepub fn resolved_width(&self, available: f32) -> Option<f32>
pub fn resolved_width(&self, available: f32) -> Option<f32>
The width this asks for in a stack available wide, and None when it asks for
the child’s own.
Sourcepub fn resolved_height(&self, available: f32) -> Option<f32>
pub fn resolved_height(&self, available: f32) -> Option<f32>
The height this asks for in a stack available tall, and None when it asks for
the child’s own.
Sourcepub fn place(
near: Option<f32>,
far: Option<f32>,
available: f32,
own: f32,
fraction: f32,
) -> f32
pub fn place( near: Option<f32>, far: Option<f32>, available: f32, own: f32, fraction: f32, ) -> f32
Where the box goes on one axis, given the stack’s extent, the child’s own and the share of the free space the stack’s alignment asks for.
The near edge wins if it is pinned; failing that the far edge places the box by its own size; failing both, the stack aligns it.