mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 19:56:42 +01:00
wip: draw phrase pool
This commit is contained in:
parent
a6b08a3249
commit
5b0feddbcb
4 changed files with 71 additions and 11 deletions
|
|
@ -98,6 +98,10 @@ pub trait Area<N: Number>: Copy {
|
|||
[self.x(), self.y(), self.w(), a],
|
||||
[self.x(), self.y() + a, self.w(), self.h() - a],
|
||||
),
|
||||
Direction::Right => (
|
||||
[self.x(), self.y(), a, self.h()],
|
||||
[self.x() + a, self.y(), self.w() - a, self.h()],
|
||||
),
|
||||
_ => todo!(),
|
||||
}
|
||||
}
|
||||
|
|
@ -228,6 +232,16 @@ pub trait Layout<E: Engine>: Widget<Engine = E> + Sized {
|
|||
fn debug (self) -> DebugOverlay<E, Self> {
|
||||
DebugOverlay(self)
|
||||
}
|
||||
fn split <W: Widget<Engine = E>> (
|
||||
self, direction: Direction, amount: E::Unit, other: W
|
||||
) -> Split<E, Self, W> {
|
||||
Split::new(direction, amount, self, other)
|
||||
}
|
||||
fn split_reverse <W: Widget<Engine = E>> (
|
||||
self, direction: Direction, amount: E::Unit, other: W
|
||||
) -> Split<E, W, Self> {
|
||||
Split::new(direction, amount, other, self)
|
||||
}
|
||||
}
|
||||
|
||||
impl<E: Engine, W: Widget<Engine = E>> Layout<E> for W {}
|
||||
|
|
@ -324,6 +338,22 @@ impl Direction {
|
|||
pub fn is_right (&self) -> bool {
|
||||
match self { Self::Right => true, _ => false }
|
||||
}
|
||||
pub fn cw (&self) -> Self {
|
||||
match self {
|
||||
Self::Up => Self::Right,
|
||||
Self::Down => Self::Left,
|
||||
Self::Left => Self::Up,
|
||||
Self::Right => Self::Down,
|
||||
}
|
||||
}
|
||||
pub fn ccw (&self) -> Self {
|
||||
match self {
|
||||
Self::Up => Self::Left,
|
||||
Self::Down => Self::Right,
|
||||
Self::Left => Self::Down,
|
||||
Self::Right => Self::Up,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Override X and Y coordinates, aligning to corner, side, or center of area
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue