'and then not have to worry about layout, ever'

This commit is contained in:
🪞👃🪞 2024-12-31 23:58:51 +01:00
parent 21741ebc52
commit f7e6449324
8 changed files with 74 additions and 74 deletions

View file

@ -111,32 +111,18 @@ pub trait Area<N: Coordinate> {
#[inline] fn set_h (&self, h: N) -> [N;4] {
[self.x(), self.y(), self.w(), h]
}
fn x2 (&self) -> N {
#[inline] fn x2 (&self) -> N {
self.x() + self.w()
}
fn y2 (&self) -> N {
#[inline] fn y2 (&self) -> N {
self.y() + self.h()
}
#[inline] fn lrtb (&self) -> [N;4] {
[self.x(), self.x2(), self.y(), self.y2()]
}
#[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().minus(x), self.h()]
}
#[inline] fn shrink_y (&self, y: N) -> [N;4] {
[self.x(), self.y(), self.w(), self.h().minus(y)]
}
#[inline] fn center (&self) -> [N;2] {
[self.x() + self.w() / 2.into(), self.y() + self.h() / 2.into()]
}
fn zero () -> [N;4] {
[N::zero(), N::zero(), N::zero(), N::zero()]
}