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
@@ -5,7 +5,7 @@ package layout
import (
"image"
"gioui.org/ui"
"gioui.org/op"
)
// Stack lays out child elements on top of each other,
@@ -15,7 +15,7 @@ type Stack struct {
// smaller than the available space.
Alignment Direction
macro ui.MacroOp
macro op.MacroOp
constrained bool
ctx *Context
maxSZ image.Point
@@ -24,7 +24,7 @@ type Stack struct {
// StackChild is the layout result of a call to End.
type StackChild struct {
macro ui.MacroOp
macro op.MacroOp
dims Dimensions
}
@@ -99,9 +99,9 @@ func (s *Stack) Layout(children ...StackChild) {
case SW, S, SE:
p.Y = s.maxSZ.Y - sz.Y
}
var stack ui.StackOp
var stack op.StackOp
stack.Push(s.ctx.Ops)
ui.TransformOp{}.Offset(toPointF(p)).Add(s.ctx.Ops)
op.TransformOp{}.Offset(toPointF(p)).Add(s.ctx.Ops)
ch.macro.Add(s.ctx.Ops)
stack.Pop()
}