mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 07:35:40 +00:00
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 (
|
import (
|
||||||
"math"
|
"math"
|
||||||
|
"runtime"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"gioui.org/f32"
|
"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 {
|
switch e.Type {
|
||||||
case pointer.Press:
|
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
|
break
|
||||||
}
|
}
|
||||||
s.Stop()
|
s.Stop()
|
||||||
|
|||||||
Reference in New Issue
Block a user