live gamepad overlay tip fix

This commit is contained in:
True Zhuanjia
2026-04-09 11:48:35 +08:00
parent e2acf5ac4b
commit c4c896e43e
2 changed files with 12 additions and 1 deletions
@@ -203,6 +203,9 @@ final class AbstractGamepadOverlayView: UIView {
private func installGesturesIfNeeded() {
guard gestureRecognizers?.isEmpty != false else { return }
let singleTap = UITapGestureRecognizer(target: self, action: #selector(handleSingleTap(_:)))
singleTap.numberOfTapsRequired = 1
singleTap.cancelsTouchesInView = true
let pan = UIPanGestureRecognizer(target: self, action: #selector(handlePan(_:)))
pan.minimumNumberOfTouches = 1
pan.maximumNumberOfTouches = 1
@@ -212,15 +215,23 @@ final class AbstractGamepadOverlayView: UIView {
let doubleTap = UITapGestureRecognizer(target: self, action: #selector(handleDoubleTap(_:)))
doubleTap.numberOfTapsRequired = 2
doubleTap.cancelsTouchesInView = true
singleTap.delegate = self
pan.delegate = self
pinch.delegate = self
doubleTap.delegate = self
pan.require(toFail: doubleTap)
singleTap.require(toFail: pan)
addGestureRecognizer(pan)
addGestureRecognizer(singleTap)
addGestureRecognizer(pinch)
addGestureRecognizer(doubleTap)
}
@objc private func handleSingleTap(_ recognizer: UITapGestureRecognizer) {
guard recognizer.state == .ended else { return }
presentFirstTouchTipIfNeeded()
}
@objc private func handlePan(_ recognizer: UIPanGestureRecognizer) {
guard let superview else { return }
switch recognizer.state {
+1 -1
View File
@@ -43,7 +43,7 @@ import Foundation
}
@objc static func isFirstLaunchGamepadOverlayFeature() -> Bool {
let key = "hasTouchedGamepadOverlayFeature20260405-1"
let key = "hasTouchedGamepadOverlayFeature20260405-2"
let defaults = UserDefaults.standard
let launchedBefore = defaults.bool(forKey: key)