- functional button fixes

- tweak auto dock animation
- input fixes
This commit is contained in:
True Zhuanjia committed 2026-04-11 14:34:54 +08:00
1 parent 46834a8a8b
commit f702f726b7
4 files changed
+13 -8

No files matched your search

+2
View File
@@ -78,6 +78,7 @@ import Foundation
// 单一 gamepad.valueChangedHandler // 单一 gamepad.valueChangedHandler
gamepad.valueChangedHandler = { gamepad, element in gamepad.valueChangedHandler = { gamepad, element in
/*
navigationActionTriggeredPrivate = (gamepad.dpad.up.isPressed navigationActionTriggeredPrivate = (gamepad.dpad.up.isPressed
|| gamepad.dpad.down.isPressed || gamepad.dpad.down.isPressed
|| gamepad.dpad.left.isPressed || gamepad.dpad.left.isPressed
@@ -101,6 +102,7 @@ import Foundation
} }
} }
} }
*/
handler(buttonDict, gamepad, element) handler(buttonDict, gamepad, element)
if #available(iOS 13.0, *) { if #available(iOS 13.0, *) {
if controller.playerIndex == .index1 { if controller.playerIndex == .index1 {
+3 -4
View File
@@ -37,13 +37,12 @@
} }
bool physicalGamepadConnected = ControllerUtil.activeGCControllers.count>0; bool physicalGamepadConnected = ControllerUtil.activeGCControllers.count>0;
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, physicalGamepadConnected ? 0.005*NSEC_PER_SEC : 0), dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ // dispatch_after(dispatch_time(DISPATCH_TIME_NOW, physicalGamepadConnected ? 0.005*NSEC_PER_SEC : 0), dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
if(!physicalGamepadConnected if(!physicalGamepadConnected)
|| !ControllerUtil.navigationActionTriggered)
LiSendKeyboardEvent(0x8000 | keyCode, LiSendKeyboardEvent(0x8000 | keyCode,
down ? KEY_ACTION_DOWN : KEY_ACTION_UP, down ? KEY_ACTION_DOWN : KEY_ACTION_UP,
0); 0);
}); // });
return YES; return YES;
} }
+7 -4
View File
@@ -2957,7 +2957,7 @@ import ObjectiveC.runtime
} }
// MARK: - Auto Dock // MARK: - Auto Dock
private static let autoDockExposedEdgeLength: CGFloat = 80 private static let autoDockExposedEdgeLength: CGFloat = GenericUtils.isIPhone() ? 90 : 105
private static let autoDockExposedThickness: CGFloat = 17 private static let autoDockExposedThickness: CGFloat = 17
private static let autoDockVerticalInset: CGFloat = 12 private static let autoDockVerticalInset: CGFloat = 12
@objc var autoDockIdleDuration: TimeInterval = 5 @objc var autoDockIdleDuration: TimeInterval = 5
@@ -2990,6 +2990,7 @@ import ObjectiveC.runtime
private var autoDockStoredCenter: CGPoint? private var autoDockStoredCenter: CGPoint?
private var autoDockDockedCenter: CGPoint? private var autoDockDockedCenter: CGPoint?
private var autoDockDockedToBottomEdge: Bool = false private var autoDockDockedToBottomEdge: Bool = false
private var autoDockDistance: CGFloat = 3
private var autoDockIsDocked: Bool = false private var autoDockIsDocked: Bool = false
private var autoDockEnabled: Bool = false private var autoDockEnabled: Bool = false
private var autoDockSettledAlphaTimer: Timer? private var autoDockSettledAlphaTimer: Timer?
@@ -3172,6 +3173,8 @@ import ObjectiveC.runtime
autoDockStoredCenter = center autoDockStoredCenter = center
let rightDistance = hostView.bounds.width - frame.maxX let rightDistance = hostView.bounds.width - frame.maxX
let bottomDistance = hostView.bounds.height - frame.maxY let bottomDistance = hostView.bounds.height - frame.maxY
autoDockDistance = min(rightDistance, bottomDistance)
print("autoDockDistance \(autoDockDistance) ...")
autoDockDockedToBottomEdge = bottomDistance < rightDistance autoDockDockedToBottomEdge = bottomDistance < rightDistance
let targetFrame = autoDockTargetFrame(in: hostView.bounds) let targetFrame = autoDockTargetFrame(in: hostView.bounds)
@@ -3188,7 +3191,7 @@ import ObjectiveC.runtime
self.frame = targetFrame self.frame = targetFrame
self.transform = CGAffineTransform(scaleX: 0.985, y: 0.985) self.transform = CGAffineTransform(scaleX: 0.985, y: 0.985)
} completion: { _ in } completion: { _ in
UIView.animate(withDuration: 0.14, delay: 0, options: [.allowUserInteraction, .curveEaseOut]) { UIView.animate(withDuration: 0.1, delay: 0, options: [.allowUserInteraction, .curveEaseOut]) {
self.autoDockApplyTemporarySize() self.autoDockApplyTemporarySize()
self.transform = .identity self.transform = .identity
self.label.alpha = 0 self.label.alpha = 0
@@ -3198,7 +3201,7 @@ import ObjectiveC.runtime
self.autoDockStopSettledAlphaTimer() self.autoDockStopSettledAlphaTimer()
self.autoDockSettledAlphaTimer = Timer.scheduledTimer(withTimeInterval: OnScreenWidgetView.autoDockSettledAlphaDelay, repeats: false) { [weak self] _ in self.autoDockSettledAlphaTimer = Timer.scheduledTimer(withTimeInterval: OnScreenWidgetView.autoDockSettledAlphaDelay, repeats: false) { [weak self] _ in
guard let self, self.autoDockIsDocked else { return } guard let self, self.autoDockIsDocked else { return }
UIView.animate(withDuration: 0.2, delay: 0, options: [.allowUserInteraction, .curveEaseOut]) { UIView.animate(withDuration: 0.17, delay: 0, options: [.allowUserInteraction, .curveEaseOut]) {
self.isUserInteractionEnabled = true self.isUserInteractionEnabled = true
self.alpha = self.autoDockSettledAlpha self.alpha = self.autoDockSettledAlpha
} }
@@ -3228,7 +3231,7 @@ import ObjectiveC.runtime
if animated { if animated {
UIView.animate( UIView.animate(
withDuration: 0.38, withDuration: autoDockDistance/(175/0.38),
delay: 0, delay: 0,
usingSpringWithDamping: OnScreenWidgetView.autoDockReturnDamping, usingSpringWithDamping: OnScreenWidgetView.autoDockReturnDamping,
initialSpringVelocity: 0.22, initialSpringVelocity: 0.22,
@@ -954,6 +954,7 @@
} }
- (void) returnToMainFrame { - (void) returnToMainFrame {
[_streamView saveStreamViewWidgetChanges];
[_streamView clearOnScreenWidgets]; [_streamView clearOnScreenWidgets];
if(micHandler) [micHandler clean]; if(micHandler) [micHandler clean];
PencilHandler.shared = nil; PencilHandler.shared = nil;