fix Size, begin fixing View

This commit is contained in:
i do not exist 2026-04-13 17:30:43 +03:00
parent a06ea2ac13
commit a93fe92a59
3 changed files with 38 additions and 18 deletions

View file

@ -491,3 +491,24 @@ pub fn iter_west <
> (_items: V, _cb: F) -> impl Draw<T> {
thunk(move|_to: &mut T|{ todo!() })
}
#[derive(Default, Debug)]
pub struct Size(AtomicUsize, AtomicUsize);
impl X<u16> for Size {
fn x (&self) -> u16 { 0 }
fn w (&self) -> u16 { self.0.load(Relaxed) as u16 }
}
impl Y<u16> for Size {
fn y (&self) -> u16 { 0 }
fn h (&self) -> u16 { self.1.load(Relaxed) as u16 }
}
impl Size {
pub const fn of <T: Screen> (&self, of: impl Draw<T>) -> impl Draw<T> {
thunk(move|to: &mut T|{
let area = of.draw(to)?;
self.0.store(area.w().into(), Relaxed);
self.1.store(area.h().into(), Relaxed);
Ok(area)
})
}
}