io/pointer: add InputOp.Types to specify which types of events to receive

Signed-off-by: Gordon Klaus <gordon.klaus@gmail.com>
This commit is contained in:
Gordon Klaus
2020-06-03 15:22:48 +02:00
committed by Elias Naur
parent 4484674ab1
commit 9d2a6c48d8
7 changed files with 102 additions and 19 deletions
+4 -1
View File
@@ -124,7 +124,10 @@ func (w *quarterWidget) Layout(gtx layout.Context) layout.Dimensions {
pointer.Rect(image.Rectangle{
Max: image.Pt(gtx.Constraints.Max.X, gtx.Constraints.Max.Y),
}).Add(gtx.Ops)
pointer.InputOp{Tag: w}.Add(gtx.Ops)
pointer.InputOp{
Tag: w,
Types: pointer.Press,
}.Add(gtx.Ops)
for _, e := range gtx.Events(w) {
if e, ok := e.(pointer.Event); ok && e.Type == pointer.Press {