ui/layout: drop Flex.MainAxisSize setting and MainAxisSize type

The setting doesn't bear its own weight; it's simpler for the client
to adjust the constraints itself.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2019-07-11 19:15:17 +02:00
parent c7e85efc27
commit 10ef4576e7
+1 -13
View File
@@ -13,7 +13,6 @@ type Flex struct {
Axis Axis
MainAxisAlignment MainAxisAlignment
CrossAxisAlignment CrossAxisAlignment
MainAxisSize MainAxisSize
ops *ui.Ops
cs Constraints
@@ -29,18 +28,11 @@ type FlexChild struct {
dims Dimens
}
type MainAxisSize uint8
type MainAxisAlignment uint8
type CrossAxisAlignment uint8
type flexMode uint8
const (
Max MainAxisSize = iota
Min
)
const (
Start = 100 + iota
End
@@ -136,11 +128,7 @@ func (f *Flex) Layout(children ...FlexChild) Dimens {
mainc := axisMainConstraint(f.Axis, f.cs)
crossSize := axisCrossConstraint(f.Axis, f.cs).Constrain(f.maxCross)
var space int
if mainc.Max != ui.Inf && f.MainAxisSize == Max {
if mainc.Max > f.size {
space = mainc.Max - f.size
}
} else if mainc.Min > f.size {
if mainc.Min > f.size {
space = mainc.Min - f.size
}
var mainSize int