From 8834bb6d9db4ad1b72d9575905ca1b739320e540 Mon Sep 17 00:00:00 2001 From: Joscha Date: Fri, 17 Feb 2023 21:14:33 +0100 Subject: [PATCH] Add more Float functions --- src/widgets/float.rs | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/widgets/float.rs b/src/widgets/float.rs index 6c35504..602c793 100644 --- a/src/widgets/float.rs +++ b/src/widgets/float.rs @@ -31,6 +31,34 @@ impl Float { 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) { let mut inner_pos = Pos::ZERO;