From eb9c2896cd1f89a1590eac102f017317285dfc1f Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Mon, 15 Jul 2019 21:43:53 +0200 Subject: [PATCH] ui/layout: round, not truncate, flex sizes in Flex.Flexible Without proper rounding, a pixel could be left uncovered at the end of the flex layout. Signed-off-by: Elias Naur --- ui/layout/flex.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/layout/flex.go b/ui/layout/flex.go index f2dbeebe..03130f86 100644 --- a/ui/layout/flex.go +++ b/ui/layout/flex.go @@ -94,7 +94,7 @@ func (f *Flex) Flexible(weight float32) Constraints { if mainc.Max != ui.Inf && mainc.Max > f.size { maxSize := mainc.Max - f.size flexSize = mainc.Max - f.rigidSize - flexSize = int(float32(flexSize) * weight) + flexSize = int(float32(flexSize)*weight + .5) if flexSize > maxSize { flexSize = maxSize }