mirror of
https://codeberg.org/unspeaker/tengri.git
synced 2026-07-17 07:56:56 +02:00
This commit is contained in:
parent
482b624169
commit
aa0dd37d88
1 changed files with 16 additions and 16 deletions
|
|
@ -290,24 +290,24 @@ pub struct Align<T>(Option<Azimuth>, T);
|
|||
impl_draw!(<S: Screen, T: Draw<S>,>|self: Align<T>, to: S|{
|
||||
use Azimuth::*;
|
||||
let XYWH(x0, y0, w0, h0) = to.area();
|
||||
Ok(if let Some(XYWH(x, y, w, h)) = self.1.layout(to.area())? {
|
||||
if let Some(XYWH(x, y, w, h)) = self.1.layout(to.area())? {
|
||||
to.clip(match self.0 {
|
||||
Some(NW) => XYWH(x0, y0, w, h),
|
||||
Some(N) => todo!(),
|
||||
Some(NE) => todo!(),
|
||||
Some(W) => todo!(),
|
||||
Some(C) => todo!(),
|
||||
Some(E) => todo!(),
|
||||
Some(SW) => todo!(),
|
||||
Some(N) => XYWH(x0 + w0.sub(w) / 2.into(), y0, w, h),
|
||||
Some(NE) => XYWH((x0 + w0).sub(w), y0, w, h),
|
||||
Some(W) => XYWH(x0, y0 + h0.sub(h) / 2.into(), w, h),
|
||||
Some(C) => XYWH(x0 + w0.sub(w) / 2.into(), y0 + h0.sub(h) / 2.into(), w, h),
|
||||
Some(E) => XYWH((x0 + w0).sub(w), y0 + h0.sub(h) / 2.into(), w, h),
|
||||
Some(SW) => XYWH(x0, (y0 + h0).sub(h), w, h),
|
||||
Some(S) => XYWH(x0 + w0.sub(w) / 2.into(), (y0 + h0).sub(h), w, h),
|
||||
Some(SE) => todo!(),
|
||||
Some(X) => todo!(),
|
||||
Some(Y) => todo!(),
|
||||
Some(SE) => XYWH((x0 + w0).sub(w), (y0 + h0).sub(h), w, h),
|
||||
Some(X) => XYWH(x0 + w0.sub(w) / 2.into(), y, w, h),
|
||||
Some(Y) => XYWH(x, y0 + h0.sub(h) / 2.into(), w, h),
|
||||
None => to.area()
|
||||
}, |to|self.1.draw(to))?
|
||||
}, |to|self.1.draw(to))
|
||||
} else {
|
||||
None
|
||||
})
|
||||
self.1.draw(to)
|
||||
}
|
||||
});
|
||||
|
||||
/// Where is [0, 0] located?
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue