#[derive(Copy, Clone, Debug, PartialEq, Eq, Default)]
pub enum Direction {
#[default]
Row,
Column,
}
#[derive(Copy, Clone, Debug, PartialEq, Eq, Default)]
pub enum Justify {
#[default]
Start,
Center,
End,
SpaceBetween,
SpaceAround,
}
#[derive(Copy, Clone, Debug, PartialEq, Eq, Default)]
pub enum Align {
#[default]
Start,
Center,
End,
Stretch,
}
#[derive(Copy, Clone, Debug, Default, PartialEq)]
pub struct Padding {
pub top: f32,
pub right: f32,
pub bottom: f32,
pub left: f32,
}
impl From<f32> for Padding {
fn from(v: f32) -> Self {
Padding { top: v, right: v, bottom: v, left: v }
}
}
impl From<(f32, f32)> for Padding {
fn from((vertical, horizontal): (f32, f32)) -> Self {
Padding { top: vertical, right: horizontal, bottom: vertical, left: horizontal }
}
}
impl From<(f32, f32, f32, f32)> for Padding {
fn from((top, right, bottom, left): (f32, f32, f32, f32)) -> Self {
Padding { top, right, bottom, left }
}
}
#[derive(Copy, Clone, Debug, PartialEq)]
pub enum Length {
Pixel(f32),
Percent(f32),
}
impl Length {
pub fn pixel(value: f32) -> Length {
Length::Pixel(value)
}
pub fn percent(value: f32) -> Length {
Length::Percent(value)
}
}