rosace_layout/alignment.rs
1//! Alignment enumerations for flex-style layout axes.
2
3/// How children are distributed along the *main* axis of a flex container.
4///
5/// The main axis of a [`Column`](crate::widgets::column::Column) is vertical;
6/// for a [`Row`](crate::widgets::row::Row) it is horizontal.
7#[derive(Debug, Clone, Copy, PartialEq, Default)]
8pub enum MainAxisAlignment {
9 /// Pack children at the start of the main axis.
10 #[default]
11 Start,
12 /// Center children on the main axis.
13 Center,
14 /// Pack children at the end of the main axis.
15 End,
16 /// Distribute remaining space evenly *between* children (no leading/trailing space).
17 SpaceBetween,
18 /// Distribute remaining space evenly *around* children (half-space at each edge).
19 SpaceAround,
20 /// Distribute remaining space evenly *between and around* children.
21 SpaceEvenly,
22}
23
24/// How children are aligned on the *cross* axis of a flex container.
25///
26/// The cross axis of a [`Column`](crate::widgets::column::Column) is horizontal;
27/// for a [`Row`](crate::widgets::row::Row) it is vertical.
28#[derive(Debug, Clone, Copy, PartialEq, Default)]
29pub enum CrossAxisAlignment {
30 /// Align children at the start of the cross axis.
31 #[default]
32 Start,
33 /// Center children on the cross axis.
34 Center,
35 /// Align children at the end of the cross axis.
36 End,
37 /// Stretch children to fill the cross axis.
38 Stretch,
39 /// Align children by their text baseline (falls back to [`Start`](Self::Start)
40 /// in Phase 1 before text metrics are available).
41 Baseline,
42}
43