op: add package op for operations

Extract operation types from package ui into package op.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2019-09-30 15:41:15 +02:00
parent eba1b3a95f
commit 8cf35a1f97
27 changed files with 225 additions and 227 deletions
+5 -5
View File
@@ -6,7 +6,7 @@ import (
"image"
"gioui.org/f32"
"gioui.org/ui"
"gioui.org/op"
)
// Flex lays out child elements along an axis,
@@ -21,7 +21,7 @@ type Flex struct {
Alignment Alignment
ctx *Context
macro ui.MacroOp
macro op.MacroOp
mode flexMode
size int
rigidSize int
@@ -33,7 +33,7 @@ type Flex struct {
// FlexChild is the layout result of a call End.
type FlexChild struct {
macro ui.MacroOp
macro op.MacroOp
dims Dimensions
}
@@ -189,9 +189,9 @@ func (f *Flex) Layout(children ...FlexChild) {
cross = f.maxBaseline - b
}
}
var stack ui.StackOp
var stack op.StackOp
stack.Push(f.ctx.Ops)
ui.TransformOp{}.Offset(toPointF(axisPoint(f.Axis, mainSize, cross))).Add(f.ctx.Ops)
op.TransformOp{}.Offset(toPointF(axisPoint(f.Axis, mainSize, cross))).Add(f.ctx.Ops)
child.macro.Add(f.ctx.Ops)
stack.Pop()
mainSize += axisMain(f.Axis, dims.Size)