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 15:57:41 +0200 |
| commit | 756ada1b5c2288da5324fa4dfbc9892e069fd9a2 (patch) | |
| tree | 73a78c194fffc1a53799a12d2f56ffcb5a4cf4e7 | |
| parent | 12eb809772946e659b754d85aeea215e9f7f9b82 (diff) | |
| download | muhqs-game-756ada1b5c2288da5324fa4dfbc9892e069fd9a2.tar.gz muhqs-game-756ada1b5c2288da5324fa4dfbc9892e069fd9a2.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 |
