handle hovering automatically

This commit is contained in:
True Zhuanjia
2026-02-25 22:06:09 +08:00
parent 2c9902ce77
commit dadb292676
9 changed files with 49 additions and 40 deletions
+10 -10
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="235" height="31"/>
<rect key="frame" x="3145" y="426" width="268.5" height="31"/>
<subviews>
<label verifyAmbiguity="off" opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Auto 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="85" height="31"/>
<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"/>
<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="105" y="0.0" width="132" height="31"/>
<rect key="frame" x="138.5" y="0.0" width="132" height="31"/>
<constraints>
<constraint firstAttribute="width" constant="130" id="Akr-jH-mSd"/>
</constraints>
@@ -2123,8 +2123,8 @@
<outlet property="audioEngineStack" destination="scn-bo-PfV" id="tP0-YG-e8V"/>
<outlet property="audioOnPcStack" destination="Bbr-Wj-Z75" id="c2K-3R-whg"/>
<outlet property="audioOnPcSwitch" destination="81a-Jw-eV9" id="Oig-tg-V1I"/>
<outlet property="autoHoverStack" destination="OBt-d7-mew" id="wI7-Y6-XY9"/>
<outlet property="autoHoverSwitch" destination="hOj-4u-Swl" id="OTR-I9-gSB"/>
<outlet property="autoHoverTerminationStack" destination="OBt-d7-mew" id="wI7-Y6-XY9"/>
<outlet property="autoHoverTerminationSwitch" destination="hOj-4u-Swl" id="OTR-I9-gSB"/>
<outlet property="backgroundSessionTimerSlider" destination="lRU-fd-AsU" id="oRL-1o-xNh"/>
<outlet property="backgroundSessionTimerStack" destination="z5W-q6-Y1z" id="2MJ-Y7-uui"/>
<outlet property="bitrateLabel" destination="lMt-4H-fkV" id="mpE-bW-R48"/>
@@ -3238,19 +3238,19 @@
<image name="tray.full.fill" catalog="system" width="128" height="88"/>
<image name="video.and.waveform" catalog="system" width="128" height="94"/>
<systemColor name="linkColor">
<color red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color red="0.0" green="0.47843137254901963" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</systemColor>
<systemColor name="systemBackgroundColor">
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</systemColor>
<systemColor name="systemBrownColor">
<color red="0.63529411759999999" green="0.51764705879999995" blue="0.36862745099999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color red="0.67450980392156867" green="0.49803921568627452" blue="0.36862745098039218" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</systemColor>
<systemColor name="systemGray3Color">
<color red="0.78039215689999997" green="0.78039215689999997" blue="0.80000000000000004" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color red="0.7803921568627451" green="0.7803921568627451" blue="0.80000000000000004" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</systemColor>
<systemColor name="systemTealColor">
<color red="0.18823529410000001" green="0.69019607839999997" blue="0.78039215689999997" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color red="0.0" green="0.76470588235294112" blue="0.81568627450980391" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</systemColor>
</resources>
</document>
+1 -1
View File
@@ -58,7 +58,7 @@ typedef NS_ENUM(NSInteger, MapGyroTo) {
@property (nonatomic, assign) bool squeezeShorcutEnabled;
@property NSString *squeezeStartShortcut;
@property NSString *squeezeEndShortcut;
@property (nonatomic, assign) bool autoPencilHover;
@property (nonatomic, assign) bool autoPencilHoverTermination;
@property (nonatomic, assign) bool pencilPausesNativeTouch;
@property (nonatomic, assign) bool disablePencilSlideGestures;
+2 -2
View File
@@ -59,7 +59,7 @@
[encoder encodeBool:self.squeezeShorcutEnabled forKey:@"squeezeShorcutEnabled"];
[encoder encodeObject:self.squeezeStartShortcut forKey:@"squeezeStartShortcut"];
[encoder encodeObject:self.squeezeEndShortcut forKey:@"squeezeEndShortcut"];
[encoder encodeBool:self.autoPencilHover forKey:@"autoPencilHover"];
[encoder encodeBool:self.autoPencilHoverTermination forKey:@"autoPencilHoverTermination"];
[encoder encodeBool:self.pencilPausesNativeTouch forKey:@"pencilPausesNativeTouch"];
[encoder encodeBool:self.disablePencilSlideGestures forKey:@"disablePencilSlideGestures"];
}
@@ -157,7 +157,7 @@
forKey:@"squeezeEndShortcut"]
: @"";
self.autoPencilHover = [decoder containsValueForKey:@"autoPencilHover"] ? [decoder decodeBoolForKey:@"autoPencilHover"] : false;
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;
}
+13 -7
View File
@@ -22,7 +22,7 @@ import UIKit
private var pencilTickEnabled: Bool
private var pressureCurveEnabled: Bool = false
private var manualHoverFlag: Bool = false
@objc static var autoHoverEnabled: Bool = false
@objc static var autoHoverTerminationEnabled: Bool = true
private(set) var pencilProEnabled: Bool = false
private var isFirstMove: Bool = false
private var moveEventIndex: Int64 = 0
@@ -77,6 +77,8 @@ import UIKit
print("squeezeShorcutEnabled \(CACurrentMediaTime())")
}
// PencilHandler.autoHoverTerminationEnabled = selectedProfile.autoPencilHoverTermination
pressureCurveEnabled = selectedProfile.pressureCurveEnabled
if #available(iOS 15.0, *) {
@@ -85,7 +87,6 @@ import UIKit
self.pencilTickEnabled = self.pencilTickEnabled && info.valid
self.pencilProEnabled = info.valid
PencilHandler.pencilPausesNativeTouch = selectedProfile.pencilPausesNativeTouch && info.valid
PencilHandler.autoHoverEnabled = selectedProfile.autoPencilHover && info.valid
if info.valid {
self.setupPencilInteraction(view: self.streamView)
}
@@ -212,7 +213,7 @@ import UIKit
switch touch.phase {
case .began:
eventType = UInt8(LI_TOUCH_EVENT_DOWN)
eventType = UInt8(manualHoverFlag ? LI_TOUCH_EVENT_HOVER : LI_TOUCH_EVENT_DOWN)
touchBeganForce = targetForce
case .moved:
eventType = UInt8(manualHoverFlag ? LI_TOUCH_EVENT_HOVER : LI_TOUCH_EVENT_MOVE)
@@ -240,18 +241,23 @@ import UIKit
let sendableForce = targetForce
DispatchQueue.global().asyncAfter(deadline: dispatchMoment + tickMoment + delay) {
/*
if PencilHandler.autoHoverEnabled, eventType == UInt8(LI_TOUCH_EVENT_DOWN) {
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)))
}
*/
LiSendPenEvent(eventType, UInt8(LI_TOOL_TYPE_PEN), 0, Float(normalizedLocation.x), Float(normalizedLocation.y), sendableForce, 0, 0, self.getRotation(fromAzimuthAngle: Float(azimuth)), self.getTilt(fromAltitudeAngle: Float(altitude)))
if PencilHandler.autoHoverEnabled, eventType == UInt8(LI_TOUCH_EVENT_UP) {
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)))
DispatchQueue.global().asyncAfter(deadline: .now() + 0.015){
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)))
if PencilHandler.autoHoverTerminationEnabled {
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)))
}
}
}
}
+2 -1
View File
@@ -802,6 +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;
break;
case UIGestureRecognizerStateEnded:
@@ -837,7 +838,7 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5;
}
#endif
if(!PencilHandler.autoHoverEnabled) LiSendPenEvent(type, LI_TOOL_TYPE_PEN, 0, location.x / videoSize.width, location.y / videoSize.height,
LiSendPenEvent(type, LI_TOOL_TYPE_PEN, 0, location.x / videoSize.width, location.y / videoSize.height,
distance, 0.0f, 0.0f, rotationAngle, tiltAngle);
}
+1 -1
View File
@@ -1594,7 +1594,7 @@
}
}
},
"autoHoverStackTip" : {
"autoHoverTerminationStackTip" : {
"extractionState" : "manual",
"localizations" : {
"en" : {
@@ -281,8 +281,8 @@
@property (weak, nonatomic) IBOutlet UIStackView *disablePencilSlideGestureStack;
@property (weak, nonatomic) IBOutlet UISwitch *disablePencilSlideGestureSwitch;
@property (weak, nonatomic) IBOutlet UIStackView *autoHoverStack;
@property (weak, nonatomic) IBOutlet UISwitch *autoHoverSwitch;
@property (weak, nonatomic) IBOutlet UIStackView *autoHoverTerminationStack;
@property (weak, nonatomic) IBOutlet UISwitch *autoHoverTerminationSwitch;
#pragma clang diagnostic push
@@ -395,7 +395,7 @@ BOOL isCustomResolution(int resolutionSelected) {
[self.squeezeShortcutSwitch setOn:oscProfile.squeezeShorcutEnabled];
[self.pencilPausesNativeTouchSwitch setOn:oscProfile.pencilPausesNativeTouch];
[self.disablePencilSlideGestureSwitch setOn:oscProfile.disablePencilSlideGestures];
[self.autoHoverSwitch setOn:oscProfile.autoPencilHover];
// [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.autoPencilHover == self.autoHoverSwitch.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.autoPencilHover = self.autoHoverSwitch.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.autoHoverStack ofId:@"autoHoverStack" withInfoTag:YES withDynamicLabel:NO to:pencilSection];
// [self addSetting:self.autoHoverTerminationStack ofId:@"autoHoverTerminationStack" withInfoTag:YES 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];
@@ -1525,8 +1525,8 @@ BOOL isCustomResolution(int resolutionSelected) {
tipText = [LocalizationHelper localizedStringForKey:@"asyncFrameDequeueStackTip"];
showOnlineDocAction = false;
}
if([sender.superview.accessibilityIdentifier isEqualToString: @"autoHoverStack"]){
tipText = [LocalizationHelper localizedStringForKey:@"autoHoverStackTip"];
if([sender.superview.accessibilityIdentifier isEqualToString: @"autoHoverTerminationStack"]){
tipText = [LocalizationHelper localizedStringForKey:@"autoHoverTerminationStackTip"];
showOnlineDocAction = false;
}
@@ -3447,7 +3447,7 @@ BOOL isCustomResolution(int resolutionSelected) {
[self.squeezeShortcutSwitch setOn:false];
[self.pencilPausesNativeTouchSwitch setOn:false];
[self.disablePencilSlideGestureSwitch setOn:false];
[self.autoHoverSwitch setOn:false];
[self.autoHoverTerminationSwitch setOn:false];
NSNumber *value = notification.userInfo[@"interruption"];
@@ -3529,6 +3529,7 @@ BOOL isCustomResolution(int resolutionSelected) {
}
}
/*
- (void)autoHoverSwitchFlipped:(UISwitch* )sender{
if(sender.isOn && !settingsViewJustLoaded){
[IAPManager checkPurchaseInfo:AddOnProductPencilProPack completion:^(PurchaseInfo* info) {
@@ -3539,6 +3540,7 @@ BOOL isCustomResolution(int resolutionSelected) {
}];
}
}
*/
- (void)loadPencilSettings:(TemporarySettings*) tempSettings{
if([Utils isIPad]){
@@ -3559,7 +3561,7 @@ BOOL isCustomResolution(int resolutionSelected) {
[self.disablePencilSlideGestureSwitch addTarget:self action:@selector(disablePencilSlideGestureSwitchFlipped:) forControlEvents:UIControlEventValueChanged];
[self.pencilPausesNativeTouchSwitch addTarget:self action:@selector(pencilPausesNativeTouchSwitchFlipped:) forControlEvents:UIControlEventValueChanged];
[self.autoHoverSwitch addTarget:self action:@selector(autoHoverSwitchFlipped:) forControlEvents:UIControlEventValueChanged];
// [self.autoHoverTerminationSwitch addTarget:self action:@selector(autoHoverSwitchFlipped:) forControlEvents:UIControlEventValueChanged];
}
}
+8 -8
View File
@@ -4748,31 +4748,31 @@
}
},
"q78-aY-mIe.text" : {
"comment" : "Class = \"UILabel\"; text = \"Auto Hover\"; ObjectID = \"q78-aY-mIe\";",
"comment" : "Class = \"UILabel\"; text = \"Auto End Hover\"; ObjectID = \"q78-aY-mIe\";",
"extractionState" : "extracted_with_value",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "new",
"value" : "Auto Hover"
"value" : "Auto End Hover"
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "自动悬浮"
"state" : "needs_review",
"value" : "自动停止悬停"
}
},
"zh-Hant" : {
"stringUnit" : {
"state" : "translated",
"value" : "自動懸浮"
"state" : "needs_review",
"value" : "自動停止懸停"
}
},
"zh-HK" : {
"stringUnit" : {
"state" : "translated",
"value" : "自動懸浮"
"state" : "needs_review",
"value" : "自動停止懸停"
}
}
}