feat: auto hover
This commit is contained in:
@@ -2088,6 +2088,26 @@
|
||||
<constraint firstAttribute="height" constant="31" id="Olu-X2-Rc1"/>
|
||||
</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"/>
|
||||
<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"/>
|
||||
<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"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="130" id="Akr-jH-mSd"/>
|
||||
</constraints>
|
||||
</switch>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="31" id="pOK-3B-UtZ"/>
|
||||
</constraints>
|
||||
</stackView>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</view>
|
||||
@@ -2103,6 +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="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"/>
|
||||
|
||||
@@ -58,6 +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 pencilPausesNativeTouch;
|
||||
@property (nonatomic, assign) bool disablePencilSlideGestures;
|
||||
|
||||
|
||||
@@ -59,6 +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.pencilPausesNativeTouch forKey:@"pencilPausesNativeTouch"];
|
||||
[encoder encodeBool:self.disablePencilSlideGestures forKey:@"disablePencilSlideGestures"];
|
||||
}
|
||||
@@ -156,6 +157,7 @@
|
||||
forKey:@"squeezeEndShortcut"]
|
||||
: @"";
|
||||
|
||||
self.autoPencilHover = [decoder containsValueForKey:@"autoPencilHover"] ? [decoder decodeBoolForKey:@"autoPencilHover"] : false;
|
||||
self.pencilPausesNativeTouch = [decoder containsValueForKey:@"pencilPausesNativeTouch"] ? [decoder decodeBoolForKey:@"pencilPausesNativeTouch"] : false;
|
||||
self.disablePencilSlideGestures = [decoder containsValueForKey:@"disablePencilSlideGestures"] ? [decoder decodeBoolForKey:@"disablePencilSlideGestures"] : false;
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ import UIKit
|
||||
private var pencilTickEnabled: Bool
|
||||
private var pressureCurveEnabled: Bool = false
|
||||
private var manualHoverFlag: Bool = false
|
||||
private var autoHoverFlag: Bool = false
|
||||
@objc static var autoHoverEnabled: Bool = false
|
||||
private(set) var pencilProEnabled: Bool = false
|
||||
private var isFirstMove: Bool = false
|
||||
private var moveEventIndex: Int64 = 0
|
||||
@@ -59,15 +59,24 @@ import UIKit
|
||||
selectedProfile = profile!
|
||||
}
|
||||
|
||||
if selectedProfile.eraserShortcut != "" {
|
||||
doubleTapShorcuts.append(selectedProfile.eraserShortcut)
|
||||
doubleTapShorcuts.removeAll()
|
||||
if selectedProfile.doubleTapShorcutEnabled {
|
||||
if selectedProfile.eraserShortcut != "" {
|
||||
doubleTapShorcuts.append(selectedProfile.eraserShortcut)
|
||||
}
|
||||
if selectedProfile.brushShortcut != "" {
|
||||
doubleTapShorcuts.append(selectedProfile.brushShortcut)
|
||||
}
|
||||
}
|
||||
if selectedProfile.brushShortcut != "" {
|
||||
doubleTapShorcuts.append(selectedProfile.brushShortcut)
|
||||
|
||||
PencilHandler.squeezeStartShortcut = ""
|
||||
PencilHandler.squeezeEndShortcut = ""
|
||||
if selectedProfile.squeezeShorcutEnabled {
|
||||
PencilHandler.squeezeStartShortcut = selectedProfile.squeezeStartShortcut
|
||||
PencilHandler.squeezeEndShortcut = selectedProfile.squeezeEndShortcut
|
||||
print("squeezeShorcutEnabled \(CACurrentMediaTime())")
|
||||
}
|
||||
|
||||
PencilHandler.squeezeStartShortcut = selectedProfile.squeezeStartShortcut
|
||||
PencilHandler.squeezeEndShortcut = selectedProfile.squeezeEndShortcut
|
||||
pressureCurveEnabled = selectedProfile.pressureCurveEnabled
|
||||
|
||||
if #available(iOS 15.0, *) {
|
||||
@@ -76,6 +85,7 @@ 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)
|
||||
}
|
||||
@@ -229,9 +239,21 @@ 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 eventType == UInt8(LI_TOUCH_EVENT_UP) {
|
||||
|
||||
if PencilHandler.autoHoverEnabled, 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)))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -255,6 +277,7 @@ import UIKit
|
||||
private func setupPencilInteraction(view:UIView?) {
|
||||
let interaction = UIPencilInteraction()
|
||||
guard let view else { return }
|
||||
if pencilInteraction != nil {return}
|
||||
interaction.delegate = self
|
||||
view.addInteraction(interaction)
|
||||
pencilInteraction = interaction
|
||||
@@ -265,6 +288,7 @@ import UIKit
|
||||
if !pencilProEnabled {return}
|
||||
if doubleTapShorcuts.isEmpty {return}
|
||||
let keyStrings = CommandManager.shared.extractAutoReleaseButtonStrings(from: doubleTapShorcuts[shortcutIndex])
|
||||
print("pencilInteractionDidTap \(CACurrentMediaTime())")
|
||||
CommandManager.shared.sendAutoReleaseComboCommand(cmdStrings: keyStrings, delay: 0.1)
|
||||
shortcutIndex = (shortcutIndex + 1) % doubleTapShorcuts.count
|
||||
}
|
||||
@@ -275,6 +299,8 @@ import UIKit
|
||||
didReceiveSqueeze squeeze: UIPencilInteraction.Squeeze
|
||||
) {
|
||||
if !pencilProEnabled {return}
|
||||
if PencilHandler.squeezeStartShortcut == "", PencilHandler.squeezeEndShortcut == "" {return}
|
||||
|
||||
let keepPressedUntilRelease = PencilHandler.squeezeEndShortcut.uppercased() == "NULL"
|
||||
let squeezePressKeyStrings = CommandManager.shared.extractAutoReleaseButtonStrings(from: PencilHandler.squeezeStartShortcut)
|
||||
let squeezeReleaseKeyStrings = CommandManager.shared.extractAutoReleaseButtonStrings(from: PencilHandler.squeezeEndShortcut)
|
||||
|
||||
@@ -837,7 +837,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.autoHoverEnabled) LiSendPenEvent(type, LI_TOOL_TYPE_PEN, 0, location.x / videoSize.width, location.y / videoSize.height,
|
||||
distance, 0.0f, 0.0f, rotationAngle, tiltAngle);
|
||||
}
|
||||
|
||||
|
||||
@@ -1594,6 +1594,35 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"autoHoverStackTip" : {
|
||||
"extractionState" : "manual",
|
||||
"localizations" : {
|
||||
"en" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "Resolves compatibility issues with certain PC software (such as SAI2) that cannot function properly without hover state."
|
||||
}
|
||||
},
|
||||
"zh-Hans" : {
|
||||
"stringUnit" : {
|
||||
"state" : "needs_review",
|
||||
"value" : "用于解决部分PC软件(如SAI2)没有悬浮状态则无法正常使用的问题。"
|
||||
}
|
||||
},
|
||||
"zh-Hant" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "此功能用於解決部分 PC 軟體(例如 SAI2)在沒有懸浮狀態時無法正常使用的問題。"
|
||||
}
|
||||
},
|
||||
"zh-HK" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "此功能用於解決部分 PC 軟體(例如 SAI2)在沒有懸浮狀態時無法正常使用的問題。"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"Autotap timer " : {
|
||||
"extractionState" : "manual",
|
||||
"localizations" : {
|
||||
|
||||
@@ -281,6 +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;
|
||||
|
||||
|
||||
#pragma clang diagnostic push
|
||||
|
||||
@@ -395,6 +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];
|
||||
}
|
||||
|
||||
- (void)saveGameProfileConfigs{
|
||||
@@ -420,6 +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
|
||||
);
|
||||
|
||||
if(!configNotChanged){
|
||||
@@ -441,7 +443,9 @@ BOOL isCustomResolution(int resolutionSelected) {
|
||||
oscProfile.squeezeShorcutEnabled = self.squeezeShortcutSwitch.isOn;
|
||||
oscProfile.pencilPausesNativeTouch = self.pencilPausesNativeTouchSwitch.isOn;
|
||||
oscProfile.disablePencilSlideGestures = self.disablePencilSlideGestureSwitch.isOn;
|
||||
oscProfile.autoPencilHover = self.autoHoverSwitch.isOn;
|
||||
[oscProfileMan replaceSelectedProfileWith:oscProfile overwriteDefault:YES];
|
||||
if(PencilHandler.shared) [PencilHandler.shared setupPressureLUTWithProfile:oscProfile];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -885,6 +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.pencilPausesNativeTouchStack ofId:@"pencilPausesNativeTouchStack" withInfoTag:NO withDynamicLabel:NO to:pencilSection];
|
||||
[self addSetting:self.disablePencilSlideGestureStack ofId:@"disablePencilSlideGestureStack" withInfoTag:NO withDynamicLabel:NO to:pencilSection];
|
||||
[pencilSection addToParentStack:_parentStack];
|
||||
@@ -1520,7 +1525,10 @@ BOOL isCustomResolution(int resolutionSelected) {
|
||||
tipText = [LocalizationHelper localizedStringForKey:@"asyncFrameDequeueStackTip"];
|
||||
showOnlineDocAction = false;
|
||||
}
|
||||
|
||||
if([sender.superview.accessibilityIdentifier isEqualToString: @"autoHoverStack"]){
|
||||
tipText = [LocalizationHelper localizedStringForKey:@"autoHoverStackTip"];
|
||||
showOnlineDocAction = false;
|
||||
}
|
||||
|
||||
UIAlertController *tipsAlertController = [UIAlertController alertControllerWithTitle: [LocalizationHelper localizedStringForKey:@"Tips"] message:tipText preferredStyle:UIAlertControllerStyleAlert];
|
||||
|
||||
@@ -3439,6 +3447,7 @@ BOOL isCustomResolution(int resolutionSelected) {
|
||||
[self.squeezeShortcutSwitch setOn:false];
|
||||
[self.pencilPausesNativeTouchSwitch setOn:false];
|
||||
[self.disablePencilSlideGestureSwitch setOn:false];
|
||||
[self.autoHoverSwitch setOn:false];
|
||||
|
||||
|
||||
NSNumber *value = notification.userInfo[@"interruption"];
|
||||
@@ -3512,7 +3521,21 @@ BOOL isCustomResolution(int resolutionSelected) {
|
||||
- (void)pencilPausesNativeTouchSwitchFlipped:(UISwitch* )sender{
|
||||
if(sender.isOn && !settingsViewJustLoaded){
|
||||
[IAPManager checkPurchaseInfo:AddOnProductPencilProPack completion:^(PurchaseInfo* info) {
|
||||
if(!info.valid) [IAPManager inAppPurchaseActionWithViewController:self product:AddOnProductPencilProPack];
|
||||
if(info.valid) nil;
|
||||
else {
|
||||
[IAPManager inAppPurchaseActionWithViewController:self product:AddOnProductPencilProPack];
|
||||
}
|
||||
}];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)autoHoverSwitchFlipped:(UISwitch* )sender{
|
||||
if(sender.isOn && !settingsViewJustLoaded){
|
||||
[IAPManager checkPurchaseInfo:AddOnProductPencilProPack completion:^(PurchaseInfo* info) {
|
||||
if(info.valid) nil;
|
||||
else {
|
||||
[IAPManager inAppPurchaseActionWithViewController:self product:AddOnProductPencilProPack];
|
||||
}
|
||||
}];
|
||||
}
|
||||
}
|
||||
@@ -3536,6 +3559,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];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4747,6 +4747,36 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"q78-aY-mIe.text" : {
|
||||
"comment" : "Class = \"UILabel\"; text = \"Auto Hover\"; ObjectID = \"q78-aY-mIe\";",
|
||||
"extractionState" : "extracted_with_value",
|
||||
"localizations" : {
|
||||
"en" : {
|
||||
"stringUnit" : {
|
||||
"state" : "new",
|
||||
"value" : "Auto Hover"
|
||||
}
|
||||
},
|
||||
"zh-Hans" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "自动悬浮"
|
||||
}
|
||||
},
|
||||
"zh-Hant" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "自動懸浮"
|
||||
}
|
||||
},
|
||||
"zh-HK" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "自動懸浮"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"Qat-gL-qiL.text" : {
|
||||
"comment" : "Class = \"UILabel\"; text = \"Pencil Tick\"; ObjectID = \"Qat-gL-qiL\";",
|
||||
"extractionState" : "extracted_with_value",
|
||||
|
||||
Reference in New Issue
Block a user