gesture: always drag scroll on Android

Mice drags scroll on Android by convention. Further, ChromeOS converts
two-finger touchpad scroll gestures to press-drag with Source == Mouse.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2020-06-19 20:05:01 +02:00
parent 88ced59dad
commit b9f6543cf5
+7 -1
View File
@@ -11,6 +11,7 @@ package gesture
import (
"math"
"runtime"
"time"
"gioui.org/f32"
@@ -217,7 +218,12 @@ func (s *Scroll) Scroll(cfg unit.Metric, q event.Queue, t time.Time, axis Axis)
}
switch e.Type {
case pointer.Press:
if s.dragging || e.Source != pointer.Touch {
if s.dragging {
break
}
// Only scroll on touch drags, or on Android where mice
// drags also scroll by convention.
if e.Source != pointer.Touch && runtime.GOOS != "android" {
break
}
s.Stop()