Introduce and use CrossAlign enum for Column and Row

This commit is contained in:
Héctor Ramón Jiménez 2021-09-20 14:33:02 +07:00
parent 95e4791a1e
commit 5fae6e59ff
No known key found for this signature in database
GPG key ID: 140CC052C94F138E
33 changed files with 166 additions and 115 deletions

View file

@ -9,11 +9,34 @@ pub enum Align {
/// Align at the end of the axis.
End,
}
/// Alignment on the cross axis of a container.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum CrossAlign {
/// Align at the start of the axis.
Start,
/// Align at the center of the axis.
Center,
/// Align at the end of the axis.
End,
/// Fill the entire axis.
Fill,
}
impl From<Align> for CrossAlign {
fn from(align: Align) -> Self {
match align {
Align::Start => Self::Start,
Align::Center => Self::Center,
Align::End => Self::End,
}
}
}
/// The horizontal alignment of some resource.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum HorizontalAlignment {

View file

@ -29,7 +29,7 @@ mod rectangle;
mod size;
mod vector;
pub use align::{Align, HorizontalAlignment, VerticalAlignment};
pub use align::{Align, CrossAlign, HorizontalAlignment, VerticalAlignment};
pub use background::Background;
pub use color::Color;
pub use font::Font;