implementing Fixed constraint

This commit is contained in:
🪞👃🪞 2024-09-12 20:19:07 +03:00
parent a57bb60ac9
commit 4b19abd98a
4 changed files with 66 additions and 10 deletions

View file

@ -385,6 +385,26 @@ impl<T> Align<T> {
}
}
/// Enforce fixed size of drawing area
pub enum Fixed<U: Number, T> {
/// Enforce fixed width
W(U, T),
/// Enforce fixed height
H(U, T),
/// Enforce fixed width and height
WH(U, U, T),
}
impl<N: Number, T> Fixed<N, T> {
pub fn inner (&self) -> &T {
match self {
Self::W(_, inner) => inner,
Self::H(_, inner) => inner,
Self::WH(_, _, inner) => inner,
}
}
}
/// Enforce minimum size of drawing area
pub enum Min<U: Number, T> {
/// Enforce minimum width