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
@@ -174,7 +174,7 @@ func (s *Scroll) Add(ops *op.Ops) {
oph := pointer.InputOp{
Tag: s,
Grab: s.grab,
Types: pointer.Press | pointer.Move | pointer.Release | pointer.Scroll,
Types: pointer.Press | pointer.Drag | pointer.Release | pointer.Scroll,
}
oph.Add(ops)
if s.flinger.Active() {
@@ -234,7 +234,7 @@ func (s *Scroll) Scroll(cfg unit.Converter, q event.Queue, t time.Time, axis Axi
iscroll := int(s.scroll)
s.scroll -= float32(iscroll)
total += iscroll
case pointer.Move:
case pointer.Drag:
if !s.dragging || s.pid != e.PointerID {
continue
}