From 529fd4d307e89dcddf79d9d83117d294bf6d3bd7 Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Sun, 6 Oct 2019 09:20:04 +0200 Subject: [PATCH] layout: rename Flex.Flexible to just Flex Signed-off-by: Elias Naur --- layout/flex.go | 8 ++++---- layout/layout_test.go | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/layout/flex.go b/layout/flex.go index 1dbf03b6..5fb426ad 100644 --- a/layout/flex.go +++ b/layout/flex.go @@ -22,7 +22,7 @@ type Flex struct { size int rigidSize int - // fraction is the rounding error from a Flexible weighting. + // fraction is the rounding error from a Flex weighting. fraction float32 maxCross int maxBaseline int @@ -76,16 +76,16 @@ func (f *Flex) Rigid(gtx *Context, w Widget) FlexChild { return FlexChild{m, dims} } -// Flexible is like Rigid, where the main axis size is also constrained to a +// Flex is like Rigid, where the main axis size is also constrained to a // fraction of the space not taken up by Rigid children. -func (f *Flex) Flexible(gtx *Context, weight float32, w Widget) FlexChild { +func (f *Flex) Flex(gtx *Context, weight float32, w Widget) FlexChild { cs := gtx.Constraints mainc := axisMainConstraint(f.Axis, cs) var flexSize int if mainc.Max > f.size { flexSize = mainc.Max - f.rigidSize // Apply weight and add any leftover fraction from a - // previous Flexible. + // previous Flex. size := float32(flexSize)*weight + f.fraction flexSize = int(size + .5) f.fraction = size - float32(flexSize) diff --git a/layout/layout_test.go b/layout/layout_test.go index a55b568f..249fb64f 100644 --- a/layout/layout_test.go +++ b/layout/layout_test.go @@ -71,7 +71,7 @@ func ExampleFlex() { }) // Child with 50% space allowance. - child2 := flex.Flexible(gtx, 0.5, func() { + child2 := flex.Flex(gtx, 0.5, func() { fmt.Printf("50%%: %v\n", gtx.Constraints.Width) layoutWidget(gtx, 10, 10) })