make Draw::clip take drawable instead of fn

This commit is contained in:
facile pop culture reference 2026-08-03 11:40:43 +03:00
parent cc4a428143
commit 4c25dcc702
9 changed files with 35 additions and 33 deletions

View file

@ -24,16 +24,16 @@ impl_draw!(<T: Screen, I: Draw<T>, X: Into<Option<T::Unit>>,>|self: Min<T, I, X>
Self::__(_) => unreachable!(),
Self::W(item, w1) if let Some(XYWH(x, y, w, h)) = item.layout(to.area())? => {
let w = w1.into().map(|w1|w.max(w1)).unwrap_or(w);
to.clip(XYWH(x, y, w, h), |to|item.draw(to))
to.clip(XYWH(x, y, w, h), item)
},
Self::H(item, h1) if let Some(XYWH(x, y, w, h)) = item.layout(to.area())? => {
let h = h1.into().map(|h1|h.max(h1)).unwrap_or(h);
to.clip(XYWH(x, y, w, h), |to|item.draw(to))
to.clip(XYWH(x, y, w, h), item)
},
Self::WH(item, w1, h1) if let Some(XYWH(x, y, w, h)) = item.layout(to.area())? => {
let w = w1.into().map(|w1|w.max(w1)).unwrap_or(w);
let h = h1.into().map(|h1|h.max(h1)).unwrap_or(h);
to.clip(XYWH(x, y, w, h), |to|item.draw(to))
to.clip(XYWH(x, y, w, h), item)
},
_ => Ok(None)
}