ui: rename block to macro

It is a more precise name.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2019-07-15 20:31:11 +02:00
parent f36070f716
commit 3b5fcfe2bb
10 changed files with 77 additions and 76 deletions
+5 -5
View File
@@ -24,7 +24,7 @@ type Flex struct {
}
type FlexChild struct {
block ui.BlockOp
macro ui.MacroOp
dims Dimens
}
@@ -74,7 +74,7 @@ func (f *Flex) begin(mode flexMode) {
panic("must End before adding a child")
}
f.mode = mode
f.ops.Begin()
f.ops.Record()
}
func (f *Flex) Rigid() Constraints {
@@ -107,7 +107,7 @@ func (f *Flex) End(dims Dimens) FlexChild {
if f.mode <= modeBegun {
panic("End called without an active child")
}
block := f.ops.End()
macro := f.ops.Stop()
sz := axisMain(f.Axis, dims.Size)
f.size += sz
if f.mode == modeRigid {
@@ -120,7 +120,7 @@ func (f *Flex) End(dims Dimens) FlexChild {
if b := dims.Baseline; b > f.maxBaseline {
f.maxBaseline = b
}
return FlexChild{block, dims}
return FlexChild{macro, dims}
}
func (f *Flex) Layout(children ...FlexChild) Dimens {
@@ -160,7 +160,7 @@ func (f *Flex) Layout(children ...FlexChild) Dimens {
ui.TransformOp{
Transform: ui.Offset(toPointF(axisPoint(f.Axis, mainSize, cross))),
}.Add(f.ops)
child.block.Add(f.ops)
child.macro.Add(f.ops)
ui.PopOp{}.Add(f.ops)
mainSize += axisMain(f.Axis, dims.Size)
if i < len(children)-1 {