From 470862dbe0f5d123a135f20593325cd42bfe505a Mon Sep 17 00:00:00 2001 From: True Zhuanjia Date: Tue, 24 Feb 2026 16:49:31 +0800 Subject: [PATCH] - fixed: unable to setup updated pressure curve mapping during streaming - flexible pressure curve start point - larger pressure curve view --- VoidLink/AlertControllerUtil.swift | 1 + VoidLink/Input/PressureCurve.swift | 21 +++++++++++++-------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/VoidLink/AlertControllerUtil.swift b/VoidLink/AlertControllerUtil.swift index 15361646..2c6fe115 100644 --- a/VoidLink/AlertControllerUtil.swift +++ b/VoidLink/AlertControllerUtil.swift @@ -75,6 +75,7 @@ import UIKit confirmAction.setValue(buttonTitle, forKey: "title") if autoCompletion { autoCompletion = false + completion?() alertController.dismiss(animated: false) return } diff --git a/VoidLink/Input/PressureCurve.swift b/VoidLink/Input/PressureCurve.swift index ee18e5e2..c4edf0ea 100644 --- a/VoidLink/Input/PressureCurve.swift +++ b/VoidLink/Input/PressureCurve.swift @@ -114,6 +114,9 @@ final class PressureCurve { func value(at x: CGFloat) -> CGFloat { + guard let firstPoint = polylinePoints.first else { return 0 } + if x < firstPoint.x {return 0} + let xClamped = min(max(x, 0), 1) let segments = cachedSegments @@ -230,7 +233,7 @@ final class PressureCurveView: UIView { let curve = PressureCurve() private var draggingIndex: Int? = nil - private let hitRadius: CGFloat = 22 + private let hitRadius: CGFloat = 35 enum PressureTestStage: UInt8 { case drawingStage @@ -288,7 +291,7 @@ final class PressureCurveView: UIView { private func drawCurve(_ ctx: CGContext) { ctx.setStrokeColor(UIColor.systemBlue.cgColor) - ctx.setLineWidth(5) + ctx.setLineWidth(6) let points = curve.sampleCurve(stepsPerSegment: 60) for (i,p) in points.enumerated() { let mapped = map(p) @@ -300,7 +303,7 @@ final class PressureCurveView: UIView { private func drawTangents(_ ctx: CGContext) { let pts = curve.tangentPoints ctx.setStrokeColor(UIColor.systemPurple.cgColor) - ctx.setLineWidth(2.5) + ctx.setLineWidth(2) for i in 0..