mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-06 18:05:35 +00:00
apps: upgrade to the block to macro rename
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
|
go 1.12
|
||||||
|
|
||||||
require (
|
require (
|
||||||
gioui.org/ui v0.0.0-20190715171611-667670f9c656
|
gioui.org/ui v0.0.0-20190715183617-3b5fcfe2bb55
|
||||||
github.com/google/go-github/v24 v24.0.1
|
github.com/google/go-github/v24 v24.0.1
|
||||||
golang.org/x/exp v0.0.0-20190627132806-fd42eb6b336f
|
golang.org/x/exp v0.0.0-20190627132806-fd42eb6b336f
|
||||||
golang.org/x/image v0.0.0-20190703141733-d6a02ce849c9
|
golang.org/x/image v0.0.0-20190703141733-d6a02ce849c9
|
||||||
|
|||||||
+12
-12
@@ -126,10 +126,10 @@ var fonts struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var theme struct {
|
var theme struct {
|
||||||
text ui.BlockOp
|
text ui.MacroOp
|
||||||
tertText ui.BlockOp
|
tertText ui.MacroOp
|
||||||
brand ui.BlockOp
|
brand ui.MacroOp
|
||||||
white ui.BlockOp
|
white ui.MacroOp
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
@@ -173,10 +173,10 @@ func init() {
|
|||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
|
||||||
func colorMaterial(ops *ui.Ops, color color.RGBA) ui.BlockOp {
|
func colorMaterial(ops *ui.Ops, color color.RGBA) ui.MacroOp {
|
||||||
ops.Begin()
|
ops.Record()
|
||||||
gdraw.ColorOp{Color: color}.Add(ops)
|
gdraw.ColorOp{Color: color}.Add(ops)
|
||||||
return ops.End()
|
return ops.Stop()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *App) run() error {
|
func (a *App) run() error {
|
||||||
@@ -643,7 +643,7 @@ func (a *App) user(c ui.Config, ops *ui.Ops, cs layout.Constraints, index int) l
|
|||||||
}
|
}
|
||||||
|
|
||||||
type fill struct {
|
type fill struct {
|
||||||
material ui.BlockOp
|
material ui.MacroOp
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f fill) Layout(ops *ui.Ops, cs layout.Constraints) layout.Dimens {
|
func (f fill) Layout(ops *ui.Ops, cs layout.Constraints) layout.Dimens {
|
||||||
@@ -680,13 +680,13 @@ type clipCircle struct {
|
|||||||
|
|
||||||
func (c *clipCircle) Begin(ops *ui.Ops, cs layout.Constraints) layout.Constraints {
|
func (c *clipCircle) Begin(ops *ui.Ops, cs layout.Constraints) layout.Constraints {
|
||||||
c.ops = ops
|
c.ops = ops
|
||||||
ops.Begin()
|
ops.Record()
|
||||||
return cs
|
return cs
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *clipCircle) End(dims layout.Dimens) layout.Dimens {
|
func (c *clipCircle) End(dims layout.Dimens) layout.Dimens {
|
||||||
ops := c.ops
|
ops := c.ops
|
||||||
block := ops.End()
|
macro := ops.Stop()
|
||||||
max := dims.Size.X
|
max := dims.Size.X
|
||||||
if dy := dims.Size.Y; dy > max {
|
if dy := dims.Size.Y; dy > max {
|
||||||
max = dy
|
max = dy
|
||||||
@@ -695,12 +695,12 @@ func (c *clipCircle) End(dims layout.Dimens) layout.Dimens {
|
|||||||
rr := szf * .5
|
rr := szf * .5
|
||||||
ui.PushOp{}.Add(ops)
|
ui.PushOp{}.Add(ops)
|
||||||
rrect(ops, szf, szf, rr, rr, rr, rr)
|
rrect(ops, szf, szf, rr, rr, rr, rr)
|
||||||
block.Add(ops)
|
macro.Add(ops)
|
||||||
ui.PopOp{}.Add(ops)
|
ui.PopOp{}.Add(ops)
|
||||||
return dims
|
return dims
|
||||||
}
|
}
|
||||||
|
|
||||||
func fab(ops *ui.Ops, cs layout.Constraints, ico image.Image, mat ui.BlockOp, size int) layout.Dimens {
|
func fab(ops *ui.Ops, cs layout.Constraints, ico image.Image, mat ui.MacroOp, size int) layout.Dimens {
|
||||||
dp := image.Point{X: (size - ico.Bounds().Dx()) / 2, Y: (size - ico.Bounds().Dy()) / 2}
|
dp := image.Point{X: (size - ico.Bounds().Dx()) / 2, Y: (size - ico.Bounds().Dy()) / 2}
|
||||||
dims := image.Point{X: size, Y: size}
|
dims := image.Point{X: size, Y: size}
|
||||||
rr := float32(size) * .5
|
rr := float32(size) * .5
|
||||||
|
|||||||
+2
-2
@@ -54,9 +54,9 @@ func loop(w *app.Window) error {
|
|||||||
cfg = e.Config
|
cfg = e.Config
|
||||||
cs := layout.RigidConstraints(e.Size)
|
cs := layout.RigidConstraints(e.Size)
|
||||||
ops.Reset()
|
ops.Reset()
|
||||||
ops.Begin()
|
ops.Record()
|
||||||
draw.ColorOp{Color: maroon}.Add(ops)
|
draw.ColorOp{Color: maroon}.Add(ops)
|
||||||
material := ops.End()
|
material := ops.Stop()
|
||||||
text.Label{Material: material, Face: face, Alignment: text.Center, Text: message}.Layout(ops, cs)
|
text.Label{Material: material, Face: face, Alignment: text.Center, Text: message}.Layout(ops, cs)
|
||||||
w.Draw(ops)
|
w.Draw(ops)
|
||||||
faces.Frame()
|
faces.Frame()
|
||||||
|
|||||||
Reference in New Issue
Block a user