io/pointer: add Drag event type

This eliminates needless redraws for handlers that care about drag events and not move events, like gesture.Scroll.

Signed-off-by: Gordon Klaus <gordon.klaus@gmail.com>
This commit is contained in:
Gordon Klaus
2020-06-03 18:44:42 +02:00
committed by Elias Naur
parent cb5cc02560
commit 1a070a36b6
5 changed files with 14 additions and 6 deletions
+2 -2
View File
@@ -39,7 +39,7 @@ func TestPointerDrag(t *testing.T) {
},
},
)
assertEventSequence(t, r.Events(handler), pointer.Cancel, pointer.Enter, pointer.Press, pointer.Leave, pointer.Move)
assertEventSequence(t, r.Events(handler), pointer.Cancel, pointer.Enter, pointer.Press, pointer.Leave, pointer.Drag)
}
func TestPointerMove(t *testing.T) {
@@ -446,7 +446,7 @@ func addPointerHandler(ops *op.Ops, tag event.Tag, area image.Rectangle) {
pointer.Rect(area).Add(ops)
pointer.InputOp{
Tag: tag,
Types: pointer.Press | pointer.Move | pointer.Release | pointer.Enter | pointer.Leave,
Types: pointer.Press | pointer.Release | pointer.Move | pointer.Drag | pointer.Enter | pointer.Leave,
}.Add(ops)
}