mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 11:46:41 +01:00
implement Bsp::N
This commit is contained in:
parent
a352141dde
commit
c685621788
1 changed files with 14 additions and 0 deletions
|
|
@ -52,6 +52,11 @@ impl<E: Engine, X: Render<E>, Y: Render<E>> Render<E> for Bsp<E, X, Y> {
|
|||
let b = b.min_size(to)?.unwrap_or([0.into(), 0.into()].into());
|
||||
[a.w() + b.w(), a.h().max(b.h())].into()
|
||||
},
|
||||
Self::N(a, b) => {
|
||||
let a = a.min_size(to)?.unwrap_or([0.into(), 0.into()].into());
|
||||
let b = b.min_size(to)?.unwrap_or([0.into(), 0.into()].into());
|
||||
[a.w().max(b.w()), a.h() + b.h()].into()
|
||||
},
|
||||
_ => todo!()
|
||||
}))
|
||||
}
|
||||
|
|
@ -85,6 +90,15 @@ impl<E: Engine, X: Render<E>, Y: Render<E>> Render<E> for Bsp<E, X, Y> {
|
|||
to.render_in(to.area().push_x(s_x).into(), a)?;
|
||||
to.render_in(to.area().shrink_x(s_x).into(), b)?;
|
||||
},
|
||||
Self::N(a, b) => {
|
||||
let n = [0.into(), 0.into()].into();
|
||||
let s = to.area().wh().into();
|
||||
let s_a = a.min_size(s)?.unwrap_or(n);
|
||||
let s_b = b.min_size(s)?.unwrap_or(n);
|
||||
let s_y = (to.area().h() - s_a.h()).into();
|
||||
to.render_in(to.area().push_y(s_y).into(), a)?;
|
||||
to.render_in(to.area().shrink_y(s_y).into(), b)?;
|
||||
},
|
||||
_ => todo!()
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue