widget/material: use cosntraints for setting pointer hit areas

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2020-05-11 12:23:18 +02:00
parent 3fd1ccbbed
commit 4e20ea83a1
2 changed files with 11 additions and 2 deletions
+6 -2
View File
@@ -114,7 +114,9 @@ func (b ButtonLayoutStyle) Layout(gtx *layout.Context, button *widget.Button, w
w()
})
})
pointer.Rect(image.Rectangle{Max: gtx.Dimensions.Size}).Add(gtx.Ops)
}),
layout.Expanded(func() {
pointer.Rect(image.Rectangle{Max: gtx.Constraints.Min()}).Add(gtx.Ops)
button.Layout(gtx)
}),
)
@@ -146,7 +148,9 @@ func (b IconButtonStyle) Layout(gtx *layout.Context, button *widget.Button) {
Size: image.Point{X: size, Y: size},
}
})
pointer.Ellipse(image.Rectangle{Max: gtx.Dimensions.Size}).Add(gtx.Ops)
}),
layout.Expanded(func() {
pointer.Ellipse(image.Rectangle{Max: gtx.Constraints.Min()}).Add(gtx.Ops)
button.Layout(gtx)
}),
)