mirror of
https://codeberg.org/unspeaker/tengri.git
synced 2026-08-07 22:17:07 +02:00
make Draw::clip take drawable instead of fn
This commit is contained in:
parent
cc4a428143
commit
4c25dcc702
9 changed files with 35 additions and 33 deletions
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue