From 87f71ac5a8dc02c2eb6845645f742228cb182c70 Mon Sep 17 00:00:00 2001 From: Takayama Fumihiko Date: Sun, 15 Oct 2023 17:33:45 +0900 Subject: [PATCH] strokeStartThreshold -> strokeAccelerationMeasurementTime --- appendix/GamePadViewer/src/StickManager.swift | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/appendix/GamePadViewer/src/StickManager.swift b/appendix/GamePadViewer/src/StickManager.swift index a48fb1c70..c2273f8af 100644 --- a/appendix/GamePadViewer/src/StickManager.swift +++ b/appendix/GamePadViewer/src/StickManager.swift @@ -38,7 +38,8 @@ public class StickManager: ObservableObject { @Published var holdingAcceleration = 0.0 @Published var holdingMagnitude = 0.0 var histories: [History] = [] - let strokeStartThreshold = 0.1 // 100 ms + let strokeAccelerationMeasurementTime = 0.05 // 50 ms + var deadzoneTask: Task<(), Never>? @MainActor @@ -77,7 +78,7 @@ public class StickManager: ObservableObject { deadzoneLeftAt = now } - if now.timeIntervalSince(deadzoneLeftAt) > strokeStartThreshold { + if now.timeIntervalSince(deadzoneLeftAt) > strokeAccelerationMeasurementTime { startingStroke = false } else { startingStroke = true @@ -89,7 +90,7 @@ public class StickManager: ObservableObject { return true } - return now.timeIntervalSince($0.timeStamp) > 0.1 // 100 ms + return now.timeIntervalSince($0.timeStamp) > strokeAccelerationMeasurementTime }) histories.append(