io/pointer,gesture,app/internal/window: add pointer.Scroll event type

Signed-off-by: Gordon Klaus <gordon.klaus@gmail.com>
This commit is contained in:
Gordon Klaus
2020-06-02 16:58:31 +02:00
committed by Elias Naur
parent 275a91f26a
commit e188d0e6ff
8 changed files with 15 additions and 9 deletions
+2 -3
View File
@@ -217,8 +217,7 @@ func (s *Scroll) Scroll(cfg unit.Converter, q event.Queue, t time.Time, axis Axi
case pointer.Cancel:
s.dragging = false
s.grab = false
case pointer.Move:
// Scroll
case pointer.Scroll:
switch s.axis {
case Horizontal:
s.scroll += e.Scroll.X
@@ -228,10 +227,10 @@ 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:
if !s.dragging || s.pid != e.PointerID {
continue
}
// Drag
val := s.val(e.Position)
s.estimator.Sample(e.Time, val)
v := int(math.Round(float64(val)))