From 5a15838989833f9dcd509632ec8182a763b2aa3c Mon Sep 17 00:00:00 2001 From: Joscha Date: Fri, 17 Feb 2023 00:15:46 +0100 Subject: [PATCH] Fix Float sizing for unset directions --- src/widgets/float.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/widgets/float.rs b/src/widgets/float.rs index c19aa27..6c35504 100644 --- a/src/widgets/float.rs +++ b/src/widgets/float.rs @@ -32,9 +32,6 @@ impl Float { } fn push_inner(&self, frame: &mut Frame, size: Size, mut inner_size: Size) { - inner_size.width = inner_size.width.min(size.width); - inner_size.height = inner_size.height.min(size.height); - let mut inner_pos = Pos::ZERO; if let Some(horizontal) = self.horizontal { @@ -42,6 +39,9 @@ impl Float { // Biased towards the left if horizontal lands exactly on the // boundary between two cells inner_pos.x = (horizontal * available).floor().min(available) as i32; + inner_size.width = inner_size.width.min(size.width); + } else { + inner_size.width = size.width; } if let Some(vertical) = self.vertical { @@ -49,6 +49,9 @@ impl Float { // Biased towards the top if vertical lands exactly on the boundary // between two cells inner_pos.y = (vertical * available).floor().min(available) as i32; + inner_size.height = inner_size.height.min(size.height); + } else { + inner_size.height = size.height; } frame.push(inner_pos, inner_size);