Add more Float functions

This commit is contained in:
Joscha 2023-02-17 21:14:33 +01:00
parent 7c3277a822
commit 8834bb6d9d

View file

@ -31,6 +31,34 @@ impl<I> Float<I> {
self.horizontal(position).vertical(position) self.horizontal(position).vertical(position)
} }
pub fn left(self) -> Self {
self.horizontal(0.0)
}
pub fn right(self) -> Self {
self.horizontal(1.0)
}
pub fn top(self) -> Self {
self.vertical(0.0)
}
pub fn bottom(self) -> Self {
self.vertical(1.0)
}
pub fn center_h(self) -> Self {
self.horizontal(0.5)
}
pub fn center_v(self) -> Self {
self.vertical(0.5)
}
pub fn center(self) -> Self {
self.all(0.5)
}
fn push_inner(&self, frame: &mut Frame, size: Size, mut inner_size: Size) { fn push_inner(&self, frame: &mut Frame, size: Size, mut inner_size: Size) {
let mut inner_pos = Pos::ZERO; let mut inner_pos = Pos::ZERO;