ui: get rid of Inf

It's not worth the special cases. Use a large value where needed
(layout.List, text.Editor...) instead.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2019-07-29 12:12:51 +02:00
parent 1b684ffab6
commit 5f2adf9b2f
10 changed files with 33 additions and 81 deletions
+1 -4
View File
@@ -82,9 +82,6 @@ func (f *Flex) Rigid() Constraints {
f.begin(modeRigid)
mainc := axisMainConstraint(f.Axis, f.cs)
mainMax := mainc.Max
if mainc.Max != ui.Inf {
mainMax -= f.size
}
return axisConstraints(f.Axis, Constraint{Max: mainMax}, axisCrossConstraint(f.Axis, f.cs))
}
@@ -92,7 +89,7 @@ func (f *Flex) Flexible(weight float32) Constraints {
f.begin(modeFlex)
mainc := axisMainConstraint(f.Axis, f.cs)
var flexSize int
if mainc.Max != ui.Inf && mainc.Max > f.size {
if mainc.Max > f.size {
maxSize := mainc.Max - f.size
flexSize = mainc.Max - f.rigidSize
flexSize = int(float32(flexSize)*weight + .5)