reorganize, add Azimuth

This commit is contained in:
facile pop culture reference 2026-07-06 20:40:52 +03:00
parent bf16288884
commit 1f60b43f61
26 changed files with 677 additions and 594 deletions

80
src/draw/layout.rs Normal file
View file

@ -0,0 +1,80 @@
use crate::*;
pub enum Layout<T: Screen, X: Into<Option<T::Unit>>, I: Draw<T>> {
__(PhantomData<T>),
MinW(X, I),
MinH(X, I),
MinWH(X, X, I),
MaxW(X, I),
MaxH(X, I),
MaxWH(X, X, I),
ExactW(X, I),
ExactH(X, I),
ExactWH(X, X, I),
ClipW(X, I),
ClipH(X, I),
ClipWH(X, X, I),
}
impl_draw!(<
T: Screen,
X: Into<Option<T::Unit>>,
I: Draw<T>,
>|self: Layout<T, X, I>, to: T|{
use Layout::*;
match self {
__(_) => unreachable!(),
MinW(x, it) => {
let x = x.into();
it.draw(to)
},
MinH(y, it) => {
let y = y.into();
it.draw(to)
},
MinWH(x, y, it) => {
let x = x.into();
let y = y.into();
it.draw(to)
},
MaxW(x, it) => {
let x = x.into();
it.draw(to)
},
MaxH(y, it) => {
let y = y.into();
it.draw(to)
},
MaxWH(x, y, it) => {
let x = x.into();
let y = y.into();
it.draw(to)
},
ExactW(x, it) => {
let x = x.into();
it.draw(to)
},
ExactH(y, it) => {
let y = y.into();
it.draw(to)
},
ExactWH(x, y, it) => {
let x = x.into();
let y = y.into();
it.draw(to)
},
ClipW(x, it) => {
let x = x.into();
it.draw(to)
},
ClipH(y, it) => {
let y = y.into();
it.draw(to)
},
ClipWH(x, y, it) => {
let x = x.into();
let y = y.into();
it.draw(to)
},
}
});