diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2025-08-19 18:44:36 +0200 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2025-08-20 14:46:15 +0200 |
| commit | 98bdbc8400003f04407b039439676e4274421105 (patch) | |
| tree | 468fc96912383059f85d119264072d889b2aad8a | |
| parent | dc6b190189fdfbc570ede87b599f4386e9f10ba5 (diff) | |
| download | muhqs-game-98bdbc8400003f04407b039439676e4274421105.tar.gz muhqs-game-98bdbc8400003f04407b039439676e4274421105.zip | |
restore touch detection conditions
| -rw-r--r-- | go/ui/touchManager.go | 7 |
1 files changed, 4 insertions, 3 deletions
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 |
