io/pointer: unify area ops into a single AreaOp

Make Rect and Ellipse constructors of AreaOp.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2019-11-18 14:59:50 +01:00
parent 3edd9dd8be
commit 16cc51ee8a
6 changed files with 21 additions and 33 deletions
+2 -2
View File
@@ -72,7 +72,7 @@ func (b Button) Layout(gtx *layout.Context, button *widget.Button) {
widget.Label{}.Layout(gtx, b.shaper, b.Font, b.Text)
})
})
pointer.RectAreaOp{Rect: image.Rectangle{Max: gtx.Dimensions.Size}}.Add(gtx.Ops)
pointer.Rect(image.Rectangle{Max: gtx.Dimensions.Size}).Add(gtx.Ops)
button.Layout(gtx)
})
bg := st.Expand(gtx, func() {
@@ -105,7 +105,7 @@ func (b IconButton) Layout(gtx *layout.Context, button *widget.Button) {
Size: image.Point{X: size, Y: size},
}
})
pointer.EllipseAreaOp{Rect: image.Rectangle{Max: gtx.Dimensions.Size}}.Add(gtx.Ops)
pointer.Ellipse(image.Rectangle{Max: gtx.Dimensions.Size}).Add(gtx.Ops)
button.Layout(gtx)
})
bgcol := b.Background
+1 -1
View File
@@ -63,5 +63,5 @@ func (c *checkable) layout(gtx *layout.Context, checked bool) {
})
flex.Layout(gtx, ico, lbl)
pointer.RectAreaOp{Rect: image.Rectangle{Max: gtx.Dimensions.Size}}.Add(gtx.Ops)
pointer.Rect(image.Rectangle{Max: gtx.Dimensions.Size}).Add(gtx.Ops)
}