From 756ada1b5c2288da5324fa4dfbc9892e069fd9a2 Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Tue, 19 Aug 2025 18:44:36 +0200 Subject: restore touch detection conditions --- go/ui/touchManager.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'go') diff --git a/go/ui/touchManager.go b/go/ui/touchManager.go index a6bf2ca2..dfe4774a 100644 --- a/go/ui/touchManager.go +++ b/go/ui/touchManager.go @@ -150,7 +150,7 @@ func (in *TouchInput) Update() error { t1, t2 := in.touches[id1], in.touches[id2] originDiff := hypotenuse(t1.originX, t1.originY, t2.originX, t2.originY) currDiff := hypotenuse(t1.currX, t1.currY, t2.currX, t2.currY) - if math.Abs(originDiff-currDiff) > 3 { + if in.pinch == nil && in.pan == nil && in.longtap == nil && math.Abs(originDiff-currDiff) > 3 { t1.wasPinch = true t2.wasPinch = true in.pinch = &pinch{ @@ -164,7 +164,8 @@ func (in *TouchInput) Update() error { // Potential pan or long tap. id := in.touchIDs[0] t := in.touches[id] - if !t.wasPinch { + // The input type is not decided yet + if !t.wasPinch && !t.isPan && !t.isLongtap { diff := math.Abs(hypotenuse(t.originX, t.originY, t.currX, t.currY)) if diff > 0.5 { t.isPan = true @@ -175,7 +176,7 @@ func (in *TouchInput) Update() error { prevX: t.originX, prevY: t.originY, } - } else if in.longtap == nil && t.duration > LONGTAP_THRESHOLD { + } else if t.duration > LONGTAP_THRESHOLD { id := in.touchIDs[0] t := in.touches[id] t.isLongtap = true -- cgit v1.2.3