mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-03 00:16:15 +00:00
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:
+1
-13
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user