fix and coverage for layout modifiers
Some checks failed
/ build (push) Has been cancelled

This commit is contained in:
facile pop culture reference 2026-08-06 18:29:03 +03:00
parent cf67185ffd
commit 799e497622
10 changed files with 456 additions and 460 deletions

View file

@ -47,18 +47,21 @@ pub fn iter_south <'a, S: Screen, D: Draw<S>, I: Iterator<Item = D>> (
iter: impl Fn()->I
) -> impl Draw<S> {
draw(move|to: &mut S|{
let XYWH(x, mut y, w, mut h) = to.area();
let h0 = h;
let XYWH(x, y, w, h) = to.area();
let mut y_next = y;
let mut h_used = S::Unit::zero();
for item in iter() {
if let Some(used) = to.draw(Some(XYWH(x, y, w, h)), item)? {
y = y.add(used.y());
h = h.minus(used.y());
if h == S::Unit::zero() {
let area = XYWH(x, y_next, w, h.minus(h_used));
if let Some(used) = to.draw(area, item)? {
let used_h = used.h();
y_next = y_next.plus(used_h);
h_used = h_used.plus(used_h);
if h_used >= h {
break;
}
}
}
Ok(Some(XYWH(x, y, w, h)))
Ok(Some(XYWH(x, y, w, h_used)))
})
}