forked from joejulian/gio
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:
+7
-1
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user