- feat: gyro-off on-screen button, the opposite of "gyro" button

- fixed: auto tap slider disappeared for regular on-screen buttons
This commit is contained in:
TrueZhuanjia committed 2025-10-12 20:41:33 +08:00
1 parent dd0c36bb20
commit 3f2a011d7b
2 files changed
+8 -3

No files matched your search

+1 -1
View File
@@ -122,7 +122,7 @@ import UIKit
@objc public static let verticalTouchPads: [String] = ["LTPAD", "RTPAD", "MOUSEWHEEL", "WHEEL"]
@objc public static let bidirectionalVerticalTouchPads: [String] = ["LTPAD", "RTPAD", "MOUSEWHEEL", "WHEEL"]
@objc public static let functionalButtonCmds: [String] = ["SETTINGS"]
@objc public static let motionControlButtonCmds: [String] = ["GYRO","ACCEL","MOTION"]
@objc public static let motionControlButtonCmds: [String] = ["GYRO","GYROOFF","ACCEL","MOTION"]
// @objc public static let specialGameWidgets: [String] = ["YSRSV", "YSLT", "YSRT", "YSRB", "YSB", "YSRT2", "YSRB2", "YSB2", "YSEM", "YSML", "YSMR", "YSWASD"]
+7 -2
View File
@@ -341,7 +341,7 @@ import UIKit
self.sensitivityYMin = -4
self.sensitivityYMAX = 4
}
self.hasAutoTap = self.widgetType == WidgetTypeEnum.button && self.functionalButtonString != ""
self.hasAutoTap = self.widgetType == WidgetTypeEnum.button && self.functionalButtonString == "" && self.motionControlButtonString == ""
self.isMousePad = self.touchPadString == "MOUSEPAD" && widgetType == WidgetTypeEnum.touchPad
self.hasTrackBall = self.touchPadString == "TRACKBALL"
self.isFuncationalButton = self.functionalButtonString != ""
@@ -1175,6 +1175,8 @@ import UIKit
else {self.buttonDownVisualEffectWidth = 9}
}
if self.motionControlButtonString != "" {self.buttonDownVisualEffectWidth = 4}
// Set the frame to be larger than the view to expand outward
buttonDownVisualEffectLayer.borderWidth = 0 // set this 0 to hide the visual effect first
buttonDownVisualEffectLayer.frame = self.bounds.insetBy(dx: -self.buttonDownVisualEffectWidth, dy: -self.buttonDownVisualEffectWidth) // Adjust the inset as needed
@@ -1690,6 +1692,8 @@ import UIKit
switch self.motionControlButtonString {
case "GYRO":
self.functionalButtonDelegate?.startGyroUpdate()
case "GYROOFF":
self.functionalButtonDelegate?.stopGyroUpdate(interruption:false)
case "ACCEL":
self.functionalButtonDelegate?.startAccelUpdate()
case "MOTION":
@@ -1701,10 +1705,11 @@ import UIKit
}
private func handleMotionControlButtonUp(){
let longPressed = CACurrentMediaTime() - self.touchTapTimeStamp > 0.3
switch self.motionControlButtonString {
case "GYRO":
self.functionalButtonDelegate?.stopGyroUpdate(interruption: false)
case "GYROOFF":
self.functionalButtonDelegate?.startGyroUpdate()
case "ACCEL":
self.functionalButtonDelegate?.stopAccelUpdate(interruption: false)
case "MOTION":