From 24d031b51c85507199b0e33e44c5a871882f6b32 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Tue, 8 Nov 2022 04:11:06 +0100 Subject: Cast to `u16` first then divide by `2` in `Padding::fit` --- core/src/padding.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'core/src/padding.rs') diff --git a/core/src/padding.rs b/core/src/padding.rs index ad5d1f0f..8d701f80 100644 --- a/core/src/padding.rs +++ b/core/src/padding.rs @@ -79,10 +79,10 @@ impl Padding { let available = (outer - inner).max(Size::ZERO); Padding { - top: self.top.min((available.height / 2.0) as u16), - right: self.right.min((available.width / 2.0) as u16), - bottom: self.bottom.min((available.height / 2.0) as u16), - left: self.left.min((available.width / 2.0) as u16), + top: self.top.min((available.height as u16) / 2), + right: self.right.min((available.width as u16) / 2), + bottom: self.bottom.min((available.height as u16) / 2), + left: self.left.min((available.width as u16) / 2), } } } -- cgit