wip: refactor(tui): 44 errors
Some checks failed
/ build (push) Has been cancelled

This commit is contained in:
same mf who else 2026-02-15 07:07:08 +02:00
parent b7b1055fbc
commit 4fa5d74fa2
26 changed files with 1550 additions and 1548 deletions

View file

@ -49,7 +49,7 @@ impl<N: Coord> WH<N> {
}
}
impl<N: Coord> XYWH<N> {
fn zero (&self) -> Self {
fn zero () -> Self {
Self(0.into(), 0.into(), 0.into(), 0.into())
}
fn x2 (&self) -> N {
@ -250,8 +250,13 @@ impl<O: Out> Measure<O> {
}
}
impl<O: Out> From<[O::Unit; 2]> for Measure<O> {
fn from ([x, y]: [O::Unit; 2]) -> Self { Self::new(x, y) }
/// FIXME don't convert to u16 specifically
impl<O: Out> HasWH<O::Unit> for Measure<O> {
fn w (&self) -> O::Unit { (self.x.load(Relaxed) as u16).into() }
fn h (&self) -> O::Unit { (self.y.load(Relaxed) as u16).into() }
}
impl<O: Out> From<WH<O::Unit>> for Measure<O> {
fn from (WH(x, y): WH<O::Unit>) -> Self { Self::new(x, y) }
}
impl<O: Out> Layout<O> for () {
@ -460,10 +465,10 @@ layout_op_xy!(1 opt: Expand);
impl<O: Out, T: Layout<O>> Layout<O> for Expand<O::Unit, T> {
fn layout_w (&self, to: XYWH<O::Unit>) -> O::Unit {
self.inner().w(to).plus(self.dx().unwrap_or_default())
self.inner().layout_w(to).plus(self.dx().unwrap_or_default())
}
fn layout_h (&self, to: XYWH<O::Unit>) -> O::Unit {
self.inner().w(to).plus(self.dy().unwrap_or_default())
self.inner().layout_w(to).plus(self.dy().unwrap_or_default())
}
}
@ -703,8 +708,8 @@ impl<'a, O, A, B, I, F, G> Layout<O> for Map<O, A, B, I, F, G> where
fn layout (&self, area: XYWH<O::Unit>) -> XYWH<O::Unit> {
let Self { get_iter, get_item, .. } = self;
let mut index = 0;
let [mut min_x, mut min_y] = area.center();
let [mut max_x, mut max_y] = area.center();
let XY(mut min_x, mut min_y) = area.centered();
let XY(mut max_x, mut max_y) = area.center();
for item in get_iter() {
let XYWH(x, y, w, h) = get_item(item, index).layout(area);
min_x = min_x.min(x);