add disable hovering switch

This commit is contained in:
True Zhuanjia
2026-02-26 00:29:57 +08:00
parent dadb292676
commit 2bc18e2f02
6 changed files with 28 additions and 27 deletions
+6 -6
View File
@@ -22,7 +22,8 @@ import UIKit
private var pencilTickEnabled: Bool
private var pressureCurveEnabled: Bool = false
private var manualHoverFlag: Bool = false
@objc static var autoHoverTerminationEnabled: Bool = true
@objc static var hoverSupported: Bool = false
@objc static private(set) var autoHoverTermination: Bool = false
private(set) var pencilProEnabled: Bool = false
private var isFirstMove: Bool = false
private var moveEventIndex: Int64 = 0
@@ -77,7 +78,7 @@ import UIKit
print("squeezeShorcutEnabled \(CACurrentMediaTime())")
}
// PencilHandler.autoHoverTerminationEnabled = selectedProfile.autoPencilHoverTermination
PencilHandler.autoHoverTermination = selectedProfile.autoPencilHoverTermination
pressureCurveEnabled = selectedProfile.pressureCurveEnabled
@@ -226,7 +227,7 @@ import UIKit
eventType = UInt8(LI_TOUCH_EVENT_MOVE)
}
delay = manualTick ? 0.0086 : 0.017
delay = manualTick ? 0.0086 : 0
delay = eventType == UInt8(LI_TOUCH_EVENT_UP) ? delay : 0
if previousTimeStamp == 0 {
@@ -251,9 +252,8 @@ import UIKit
if eventType == UInt8(LI_TOUCH_EVENT_UP) {
PencilHandler.isDrawing = false
LiSendPenEvent(UInt8(LI_TOUCH_EVENT_HOVER), UInt8(LI_TOOL_TYPE_PEN), 0, Float(normalizedLocation.x), Float(normalizedLocation.y), 0, 0, 0, self.getRotation(fromAzimuthAngle: Float(azimuth)), self.getTilt(fromAltitudeAngle: Float(altitude)))
if PencilHandler.autoHoverTerminationEnabled {
if PencilHandler.autoHoverTermination || !PencilHandler.hoverSupported {
LiSendPenEvent(UInt8(LI_TOUCH_EVENT_HOVER), UInt8(LI_TOOL_TYPE_PEN), 0, Float(normalizedLocation.x), Float(normalizedLocation.y), 0, 0, 0, self.getRotation(fromAzimuthAngle: Float(azimuth)), self.getTilt(fromAltitudeAngle: Float(altitude)))
DispatchQueue.global().asyncAfter(deadline: .now() + 0.0086){
if !PencilHandler.isDrawing {
LiSendPenEvent(UInt8(LI_TOUCH_EVENT_HOVER_LEAVE), UInt8(LI_TOOL_TYPE_PEN), 0, Float(normalizedLocation.x), Float(normalizedLocation.y), 0, 0, 0, self.getRotation(fromAzimuthAngle: Float(azimuth)), self.getTilt(fromAltitudeAngle: Float(altitude)))