mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-03 08:25:34 +00:00
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 <mail@eliasnaur.com>
This commit is contained in:
+1
-1
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user