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
+4 -4
View File
@@ -2089,16 +2089,16 @@
</constraints>
</stackView>
<stackView verifyAmbiguity="off" opaque="NO" contentMode="scaleToFill" ambiguous="YES" spacing="20" translatesAutoresizingMaskIntoConstraints="NO" id="OBt-d7-mew">
<rect key="frame" x="3145" y="426" width="268.5" height="31"/>
<rect key="frame" x="3145" y="426" width="279.5" height="31"/>
<subviews>
<label verifyAmbiguity="off" opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Auto End Hover" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumScaleFactor="0.64999997615814209" adjustsLetterSpacingToFitWidth="YES" adjustsFontForContentSizeCategory="YES" translatesAutoresizingMaskIntoConstraints="NO" id="q78-aY-mIe" userLabel="uiLabel">
<rect key="frame" x="0.0" y="0.0" width="118.5" height="31"/>
<label verifyAmbiguity="off" opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Disable Hovering" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumScaleFactor="0.64999997615814209" adjustsLetterSpacingToFitWidth="YES" adjustsFontForContentSizeCategory="YES" translatesAutoresizingMaskIntoConstraints="NO" id="q78-aY-mIe" userLabel="uiLabel">
<rect key="frame" x="0.0" y="0.0" width="129.5" height="31"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="hOj-4u-Swl">
<rect key="frame" x="138.5" y="0.0" width="132" height="31"/>
<rect key="frame" x="149.5" y="0.0" width="132" height="31"/>
<constraints>
<constraint firstAttribute="width" constant="130" id="Akr-jH-mSd"/>
</constraints>
+2 -1
View File
@@ -157,9 +157,9 @@
forKey:@"squeezeEndShortcut"]
: @"";
self.autoPencilHoverTermination = [decoder containsValueForKey:@"autoPencilHoverTermination"] ? [decoder decodeBoolForKey:@"autoPencilHoverTermination"] : true;
self.pencilPausesNativeTouch = [decoder containsValueForKey:@"pencilPausesNativeTouch"] ? [decoder decodeBoolForKey:@"pencilPausesNativeTouch"] : false;
self.disablePencilSlideGestures = [decoder containsValueForKey:@"disablePencilSlideGestures"] ? [decoder decodeBoolForKey:@"disablePencilSlideGestures"] : false;
self.autoPencilHoverTermination = [decoder containsValueForKey:@"autoPencilHoverTermination"] ? [decoder decodeBoolForKey:@"autoPencilHoverTermination"] : false;
}
return self;
@@ -199,6 +199,7 @@
copy.squeezeEndShortcut = [self.squeezeEndShortcut mutableCopy]; // NSString → NSMutableString
copy.pencilPausesNativeTouch = self.pencilPausesNativeTouch;
copy.disablePencilSlideGestures = self.disablePencilSlideGestures;
copy.autoPencilHoverTermination = self.autoPencilHoverTermination;
return copy;
}
+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)))
+4 -4
View File
@@ -785,7 +785,7 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5;
CGPoint location = [self adjustCoordinatesForVideoArea:[event locationInView:self]];
CGSize videoSize = [self getVideoAreaSize];
CGFloat pressure = (event.force / event.maximumPossibleForce) / sin(event.altitudeAngle);
// CGFloat pressure = (event.force / event.maximumPossibleForce) / sin(event.altitudeAngle);
return LiSendPenEvent(type, LI_TOOL_TYPE_PEN, 0, location.x / videoSize.width, location.y / videoSize.height,
(event.force / event.maximumPossibleForce) / sin(event.altitudeAngle),
@@ -802,7 +802,7 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5;
case UIGestureRecognizerStateChanged:
type = LI_TOUCH_EVENT_HOVER;
isPencilHovering = true;
if(PencilHandler.autoHoverTerminationEnabled) PencilHandler.autoHoverTerminationEnabled = false;
if(!PencilHandler.hoverSupported) PencilHandler.hoverSupported = true;
break;
case UIGestureRecognizerStateEnded:
@@ -813,7 +813,7 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5;
}
if(gesture.state==UIGestureRecognizerStateEnded){
dispatch_time_t delayTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.016 * NSEC_PER_SEC));
dispatch_time_t delayTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.008 * NSEC_PER_SEC));
dispatch_after(delayTime, dispatch_get_main_queue(), ^{// Code to execute after the delay
self->isPencilHovering = false;
});
@@ -838,7 +838,7 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5;
}
#endif
LiSendPenEvent(type, LI_TOOL_TYPE_PEN, 0, location.x / videoSize.width, location.y / videoSize.height,
if(!PencilHandler.autoHoverTermination) LiSendPenEvent(type, LI_TOOL_TYPE_PEN, 0, location.x / videoSize.width, location.y / videoSize.height,
distance, 0.0f, 0.0f, rotationAngle, tiltAngle);
}
@@ -395,7 +395,7 @@ BOOL isCustomResolution(int resolutionSelected) {
[self.squeezeShortcutSwitch setOn:oscProfile.squeezeShorcutEnabled];
[self.pencilPausesNativeTouchSwitch setOn:oscProfile.pencilPausesNativeTouch];
[self.disablePencilSlideGestureSwitch setOn:oscProfile.disablePencilSlideGestures];
// [self.autoHoverTerminationSwitch setOn:oscProfile.autoPencilHoverTermination];
[self.autoHoverTerminationSwitch setOn:oscProfile.autoPencilHoverTermination];
}
- (void)saveGameProfileConfigs{
@@ -421,7 +421,7 @@ BOOL isCustomResolution(int resolutionSelected) {
&& oscProfile.squeezeShorcutEnabled == self.squeezeShortcutSwitch.isOn
&& oscProfile.pencilPausesNativeTouch == self.pencilPausesNativeTouchSwitch.isOn
&& oscProfile.disablePencilSlideGestures == self.disablePencilSlideGestureSwitch.isOn
// && oscProfile.autoPencilHoverTermination == self.autoHoverTerminationSwitch.isOn
&& oscProfile.autoPencilHoverTermination == self.autoHoverTerminationSwitch.isOn
);
if(!configNotChanged){
@@ -443,7 +443,7 @@ BOOL isCustomResolution(int resolutionSelected) {
oscProfile.squeezeShorcutEnabled = self.squeezeShortcutSwitch.isOn;
oscProfile.pencilPausesNativeTouch = self.pencilPausesNativeTouchSwitch.isOn;
oscProfile.disablePencilSlideGestures = self.disablePencilSlideGestureSwitch.isOn;
// oscProfile.autoPencilHoverTermination = self.autoHoverTerminationSwitch.isOn;
oscProfile.autoPencilHoverTermination = self.autoHoverTerminationSwitch.isOn;
[oscProfileMan replaceSelectedProfileWith:oscProfile overwriteDefault:YES];
if(PencilHandler.shared) [PencilHandler.shared setupPressureLUTWithProfile:oscProfile];
}
@@ -889,7 +889,7 @@ BOOL isCustomResolution(int resolutionSelected) {
[self addSetting:self.pressureCurveStack ofId:@"pressureCurveStack" withInfoTag:NO withDynamicLabel:NO to:pencilSection];
[self addSetting:self.doubleTapShortcutStack ofId:@"doubleTapShortcutStack" withInfoTag:YES withDynamicLabel:NO to:pencilSection];
[self addSetting:self.squeezeShortcutStack ofId:@"squeezeShortcutStack" withInfoTag:YES withDynamicLabel:NO to:pencilSection];
// [self addSetting:self.autoHoverTerminationStack ofId:@"autoHoverTerminationStack" withInfoTag:YES withDynamicLabel:NO to:pencilSection];
[self addSetting:self.autoHoverTerminationStack ofId:@"autoHoverTerminationStack" withInfoTag:NO withDynamicLabel:NO to:pencilSection];
[self addSetting:self.pencilPausesNativeTouchStack ofId:@"pencilPausesNativeTouchStack" withInfoTag:NO withDynamicLabel:NO to:pencilSection];
[self addSetting:self.disablePencilSlideGestureStack ofId:@"disablePencilSlideGestureStack" withInfoTag:NO withDynamicLabel:NO to:pencilSection];
[pencilSection addToParentStack:_parentStack];
+8 -8
View File
@@ -4748,31 +4748,31 @@
}
},
"q78-aY-mIe.text" : {
"comment" : "Class = \"UILabel\"; text = \"Auto End Hover\"; ObjectID = \"q78-aY-mIe\";",
"comment" : "Class = \"UILabel\"; text = \"Disable Hovering\"; ObjectID = \"q78-aY-mIe\";",
"extractionState" : "extracted_with_value",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "new",
"value" : "Auto End Hover"
"value" : "Disable Hovering"
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "needs_review",
"value" : "自动停止悬停"
"state" : "translated",
"value" : "关闭悬停"
}
},
"zh-Hant" : {
"stringUnit" : {
"state" : "needs_review",
"value" : "自動停止懸停"
"state" : "translated",
"value" : "關閉懸停"
}
},
"zh-HK" : {
"stringUnit" : {
"state" : "needs_review",
"value" : "自動停止懸停"
"state" : "translated",
"value" : "關閉懸停"
}
}
}