mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-09 05:06:43 +01:00
fix (?) Inset; add arranger cursor description
This commit is contained in:
parent
7df9cc930d
commit
3c8d9668fe
4 changed files with 137 additions and 151 deletions
|
|
@ -101,6 +101,12 @@ pub trait Area<N: Number>: Copy {
|
|||
_ => todo!(),
|
||||
}
|
||||
}
|
||||
#[inline] fn push_x (&self, x: N) -> [N;4] { [self.x() + x, self.y(), self.w(), self.h()] }
|
||||
#[inline] fn push_y (&self, y: N) -> [N;4] { [self.x(), self.y() + y, self.w(), self.h()] }
|
||||
#[inline] fn shrink_x (&self, x: N) -> [N;4] { [self.x(), self.y(), self.w() - x, self.h()] }
|
||||
#[inline] fn shrink_y (&self, y: N) -> [N;4] { [self.x(), self.y(), self.w(), self.h() - y] }
|
||||
#[inline] fn set_w (&self, w: N) -> [N;4] { [self.x(), self.y(), w, self.h()] }
|
||||
#[inline] fn set_h (&self, h: N) -> [N;4] { [self.x(), self.y(), self.w(), h] }
|
||||
}
|
||||
|
||||
impl<N: Number> Area<N> for (N, N, N, N) {
|
||||
|
|
@ -610,18 +616,14 @@ impl<N: Number, T: Widget> Outset<N, T> {
|
|||
|
||||
impl<E: Engine, T: Widget<Engine = E>> Widget for Inset<E::Unit, T> {
|
||||
type Engine = E;
|
||||
fn layout (&self, to: E::Size) -> Perhaps<E::Size> {
|
||||
match *self {
|
||||
Self::X(x, ref inner) => Shrink::X(x + x, inner as &dyn Widget<Engine = E>),
|
||||
Self::Y(y, ref inner) => Shrink::Y(y + y, inner as &dyn Widget<Engine = E>),
|
||||
Self::XY(x, y, ref inner) => Shrink::XY(x + x, y + y, inner as &dyn Widget<Engine = E>),
|
||||
}.layout(to)
|
||||
}
|
||||
fn render (&self, to: &mut E::Output) -> Usually<()> {
|
||||
match *self {
|
||||
Self::X(x, ref inner) => Push::X(x, inner as &dyn Widget<Engine = E>),
|
||||
Self::Y(y, ref inner) => Push::Y(y, inner as &dyn Widget<Engine = E>),
|
||||
Self::XY(x, y, ref inner) => Push::XY(x, y, inner as &dyn Widget<Engine = E>),
|
||||
Self::X(x, ref inner) =>
|
||||
Push::X(x, Shrink::X(x, inner as &dyn Widget<Engine = E>)),
|
||||
Self::Y(y, ref inner) =>
|
||||
Push::Y(y, Shrink::Y(y, inner as &dyn Widget<Engine = E>)),
|
||||
Self::XY(x, y, ref inner) =>
|
||||
Push::XY(x, y, Shrink::XY(x, y, inner as &dyn Widget<Engine = E>)),
|
||||
}.render(to)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue