mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 23:55:39 +00:00
apps: update to newest macro api
Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
+1
-1
@@ -3,7 +3,7 @@ module gioui.org/apps
|
||||
go 1.12
|
||||
|
||||
require (
|
||||
gioui.org/ui v0.0.0-20190715191043-00b9ff603f38
|
||||
gioui.org/ui v0.0.0-20190716112151-94a913a371c4
|
||||
github.com/google/go-github/v24 v24.0.1
|
||||
golang.org/x/exp v0.0.0-20190627132806-fd42eb6b336f
|
||||
golang.org/x/image v0.0.0-20190703141733-d6a02ce849c9
|
||||
|
||||
@@ -174,9 +174,11 @@ func init() {
|
||||
}
|
||||
|
||||
func colorMaterial(ops *ui.Ops, color color.RGBA) ui.MacroOp {
|
||||
ops.Record()
|
||||
var mat ui.MacroOp
|
||||
mat.Record(ops)
|
||||
gdraw.ColorOp{Color: color}.Add(ops)
|
||||
return ops.Stop()
|
||||
mat.Stop()
|
||||
return mat
|
||||
}
|
||||
|
||||
func (a *App) run() error {
|
||||
@@ -675,18 +677,19 @@ func baseline() layout.Flex {
|
||||
}
|
||||
|
||||
type clipCircle struct {
|
||||
m ui.MacroOp
|
||||
ops *ui.Ops
|
||||
}
|
||||
|
||||
func (c *clipCircle) Begin(ops *ui.Ops, cs layout.Constraints) layout.Constraints {
|
||||
c.ops = ops
|
||||
ops.Record()
|
||||
c.m.Record(ops)
|
||||
return cs
|
||||
}
|
||||
|
||||
func (c *clipCircle) End(dims layout.Dimens) layout.Dimens {
|
||||
c.m.Stop()
|
||||
ops := c.ops
|
||||
macro := ops.Stop()
|
||||
max := dims.Size.X
|
||||
if dy := dims.Size.Y; dy > max {
|
||||
max = dy
|
||||
@@ -695,7 +698,7 @@ func (c *clipCircle) End(dims layout.Dimens) layout.Dimens {
|
||||
rr := szf * .5
|
||||
ui.PushOp{}.Add(ops)
|
||||
rrect(ops, szf, szf, rr, rr, rr, rr)
|
||||
macro.Add(ops)
|
||||
c.m.Add(ops)
|
||||
ui.PopOp{}.Add(ops)
|
||||
return dims
|
||||
}
|
||||
|
||||
+3
-2
@@ -54,9 +54,10 @@ func loop(w *app.Window) error {
|
||||
cfg = e.Config
|
||||
cs := layout.RigidConstraints(e.Size)
|
||||
ops.Reset()
|
||||
ops.Record()
|
||||
var material ui.MacroOp
|
||||
material.Record(ops)
|
||||
draw.ColorOp{Color: maroon}.Add(ops)
|
||||
material := ops.Stop()
|
||||
material.Stop()
|
||||
text.Label{Material: material, Face: face, Alignment: text.Center, Text: message}.Layout(ops, cs)
|
||||
w.Draw(ops)
|
||||
faces.Frame()
|
||||
|
||||
Reference in New Issue
Block a user