feat: designate soft keyboard height manually

This commit is contained in:
True Zhuanjia
2026-03-21 19:45:21 +08:00
parent 22aa0a5249
commit eac8d15240
14 changed files with 348 additions and 20 deletions
+24 -2
View File
@@ -1791,7 +1791,7 @@
</constraints>
</stackView>
<stackView verifyAmbiguity="off" opaque="NO" contentMode="scaleToFill" ambiguous="YES" spacing="20" translatesAutoresizingMaskIntoConstraints="NO" id="RrU-mx-9jP" userLabel="multiControllerStack">
<rect key="frame" x="21" y="2025" width="318" height="31"/>
<rect key="frame" x="18" y="1978" width="318" height="31"/>
<subviews>
<label verifyAmbiguity="off" opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Multi-Controller Mode" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumScaleFactor="0.64999997615814209" adjustsLetterSpacingToFitWidth="YES" adjustsFontForContentSizeCategory="YES" translatesAutoresizingMaskIntoConstraints="NO" id="SAQ-04-n4h" userLabel="Multi-Controller Mode">
<rect key="frame" x="0.0" y="0.0" width="168" height="31"/>
@@ -1811,7 +1811,7 @@
</constraints>
</stackView>
<stackView verifyAmbiguity="off" opaque="NO" contentMode="scaleToFill" ambiguous="YES" spacing="20" translatesAutoresizingMaskIntoConstraints="NO" id="EKY-6m-OBd" userLabel="softKeyboardToolbarStack">
<rect key="frame" x="21" y="2064" width="319.5" height="31"/>
<rect key="frame" x="17" y="2017" width="319.5" height="31"/>
<subviews>
<label verifyAmbiguity="off" opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Soft Keyboard Toolbar" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumScaleFactor="0.64999997615814209" adjustsLetterSpacingToFitWidth="YES" adjustsFontForContentSizeCategory="YES" translatesAutoresizingMaskIntoConstraints="NO" id="QdG-9a-5AZ" userLabel="softKeyboardToolbarStack">
<rect key="frame" x="0.0" y="0.0" width="169.5" height="31"/>
@@ -2113,6 +2113,26 @@
<constraint firstAttribute="width" constant="380" id="n3K-F6-rQ2"/>
</constraints>
</stackView>
<stackView verifyAmbiguity="off" opaque="NO" contentMode="scaleToFill" ambiguous="YES" spacing="20" translatesAutoresizingMaskIntoConstraints="NO" id="2ww-Pv-3dP">
<rect key="frame" x="18" y="2056" width="394.5" height="31"/>
<subviews>
<label verifyAmbiguity="off" opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Designate Soft Keyboard Height" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumScaleFactor="0.64999997615814209" adjustsLetterSpacingToFitWidth="YES" adjustsFontForContentSizeCategory="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Bue-gF-hRI" userLabel="softKeyboardToolbarStack">
<rect key="frame" x="0.0" y="0.0" width="244.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="Q5O-zy-xEo" userLabel="softKeyboardToolbarSwitch">
<rect key="frame" x="264.5" y="0.0" width="132" height="31"/>
<constraints>
<constraint firstAttribute="width" constant="130" id="kxD-ML-qFL"/>
</constraints>
</switch>
</subviews>
<constraints>
<constraint firstAttribute="height" constant="31" id="85R-lB-gVS"/>
</constraints>
</stackView>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</view>
@@ -2280,6 +2300,8 @@
<outlet property="slideToToolboxScreenEdgeStack" destination="msN-pa-Kn3" id="p9F-Aj-h3X"/>
<outlet property="softKeyboardGestureSelector" destination="kho-5R-daP" id="AaA-Xg-0fw"/>
<outlet property="softKeyboardGestureStack" destination="Tv6-pw-87l" id="RtJ-Ib-GJg"/>
<outlet property="softKeyboardHeightStack" destination="2ww-Pv-3dP" id="trh-dr-KEI"/>
<outlet property="softKeyboardHeightSwitch" destination="Q5O-zy-xEo" id="hbe-W2-vrk"/>
<outlet property="softKeyboardToolbarStack" destination="EKY-6m-OBd" id="B8n-Tm-yrf"/>
<outlet property="softKeyboardToolbarSwitch" destination="ztk-Xx-60P" id="A35-6y-cyp"/>
<outlet property="squeezeShortcutStack" destination="KFC-7x-FCI" id="p5C-9l-4IV"/>
+29 -7
View File
@@ -1903,7 +1903,7 @@
</constraints>
</stackView>
<stackView verifyAmbiguity="off" opaque="NO" contentMode="scaleToFill" ambiguous="YES" spacing="20" translatesAutoresizingMaskIntoConstraints="NO" id="reE-vr-Mdk" userLabel="swapABXYStack">
<rect key="frame" x="15" y="1476" width="317" height="31"/>
<rect key="frame" x="15" y="1565" width="317" height="31"/>
<subviews>
<label verifyAmbiguity="off" opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Swap A/B X/Y Buttons" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumScaleFactor="0.64999997615814209" adjustsLetterSpacingToFitWidth="YES" adjustsFontForContentSizeCategory="YES" translatesAutoresizingMaskIntoConstraints="NO" id="cl0-Qm-3kW" userLabel="uiLabel">
<rect key="frame" x="0.0" y="0.0" width="167" height="31"/>
@@ -2049,7 +2049,7 @@
</constraints>
</stackView>
<stackView verifyAmbiguity="off" opaque="NO" contentMode="scaleToFill" ambiguous="YES" spacing="20" translatesAutoresizingMaskIntoConstraints="NO" id="Kqc-3Y-QLf" userLabel="buttonVisualFeedbackStack">
<rect key="frame" x="15" y="1515" width="330" height="31"/>
<rect key="frame" x="15" y="1604" width="330" height="31"/>
<subviews>
<label verifyAmbiguity="off" opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Button Visual Feedback" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumScaleFactor="0.64999997615814209" adjustsLetterSpacingToFitWidth="YES" adjustsFontForContentSizeCategory="YES" translatesAutoresizingMaskIntoConstraints="NO" id="SQK-JJ-izW" userLabel="uiLabel">
<rect key="frame" x="0.0" y="0.0" width="180" height="31"/>
@@ -2891,7 +2891,7 @@
</constraints>
</stackView>
<stackView verifyAmbiguity="off" opaque="NO" contentMode="scaleToFill" ambiguous="YES" spacing="20" translatesAutoresizingMaskIntoConstraints="NO" id="fqe-49-wG1">
<rect key="frame" x="15" y="1554" width="309.5" height="31"/>
<rect key="frame" x="15" y="1643" width="309.5" height="31"/>
<subviews>
<label verifyAmbiguity="off" opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Touch Point Tracking" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumScaleFactor="0.64999997615814209" adjustsLetterSpacingToFitWidth="YES" adjustsFontForContentSizeCategory="YES" translatesAutoresizingMaskIntoConstraints="NO" id="BQ1-w6-Opg" userLabel="uiLabel">
<rect key="frame" x="0.0" y="0.0" width="159.5" height="31"/>
@@ -2910,6 +2910,26 @@
<constraint firstAttribute="height" constant="31" id="1SY-3l-Q83"/>
</constraints>
</stackView>
<stackView verifyAmbiguity="off" opaque="NO" contentMode="scaleToFill" ambiguous="YES" spacing="20" translatesAutoresizingMaskIntoConstraints="NO" id="KFi-mR-jCq">
<rect key="frame" x="15" y="1475" width="394.5" height="31"/>
<subviews>
<label verifyAmbiguity="off" opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Designate Soft Keyboard Height" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumScaleFactor="0.64999997615814209" adjustsLetterSpacingToFitWidth="YES" adjustsFontForContentSizeCategory="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Mhe-jU-8hh" userLabel="softKeyboardToolbarStack">
<rect key="frame" x="0.0" y="0.0" width="244.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="KoR-jY-clp" userLabel="softKeyboardToolbarSwitch">
<rect key="frame" x="264.5" y="0.0" width="132" height="31"/>
<constraints>
<constraint firstAttribute="width" constant="130" id="Eb5-ec-5mn"/>
</constraints>
</switch>
</subviews>
<constraints>
<constraint firstAttribute="height" constant="31" id="Mtc-ge-20Q"/>
</constraints>
</stackView>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</view>
@@ -3062,6 +3082,8 @@
<outlet property="slideToToolboxScreenEdgeStack" destination="rk8-nB-cPk" id="fdH-ee-0Ul"/>
<outlet property="softKeyboardGestureSelector" destination="6g1-G6-jZx" id="ace-tF-hWR"/>
<outlet property="softKeyboardGestureStack" destination="enq-vm-5pN" id="98s-mz-64n"/>
<outlet property="softKeyboardHeightStack" destination="KFi-mR-jCq" id="kj3-kz-y8Y"/>
<outlet property="softKeyboardHeightSwitch" destination="KoR-jY-clp" id="LbX-7r-D7Y"/>
<outlet property="softKeyboardToolbarStack" destination="DC8-5w-oib" id="ti3-PT-mZI"/>
<outlet property="softKeyboardToolbarSwitch" destination="c4W-2p-R3A" id="gf6-pq-L8o"/>
<outlet property="statsOverlaySelector" destination="Bda-3L-Wtg" id="9kj-wY-VjF"/>
@@ -3112,16 +3134,16 @@
<image name="trash.fill" catalog="system" width="117" height="128"/>
<image name="tray.full.fill" catalog="system" width="128" height="88"/>
<systemColor name="linkColor">
<color red="0.0" green="0.47843137254901963" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</systemColor>
<systemColor name="systemBrownColor">
<color red="0.67450980392156867" green="0.49803921568627452" blue="0.36862745098039218" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color red="0.63529411759999999" green="0.51764705879999995" blue="0.36862745099999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</systemColor>
<systemColor name="systemGray2Color">
<color red="0.68235294117647061" green="0.68235294117647061" blue="0.69803921568627447" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color red="0.68235294120000001" green="0.68235294120000001" blue="0.69803921570000005" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</systemColor>
<systemColor name="systemTealColor">
<color red="0.0" green="0.76470588235294112" blue="0.81568627450980391" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color red="0.18823529410000001" green="0.69019607839999997" blue="0.78039215689999997" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</systemColor>
</resources>
</document>
+1
View File
@@ -153,6 +153,7 @@ typedef NS_ENUM(NSInteger, PencilTickMode) {
enableFrameTimebase:(BOOL)enableFrameTimebase
asyncFrameDequeue:(BOOL)asyncFrameDequeue
sdrPerformanceWorkaround:(BOOL)sdrPerformanceWorkaround
softKeyboardHeight:(CGFloat)softKeyboardHeight
backgroundSessionTimer:(NSInteger)backgroundSessionTimer;
- (NSArray*) getHosts;
+2
View File
@@ -130,6 +130,7 @@
enableFrameTimebase:(BOOL)enableFrameTimebase
asyncFrameDequeue:(BOOL)asyncFrameDequeue
sdrPerformanceWorkaround:(BOOL)sdrPerformanceWorkaround
softKeyboardHeight:(CGFloat)softKeyboardHeight
backgroundSessionTimer:(NSInteger)backgroundSessionTimer{
__block Settings* settingsToSave = settings;
@@ -209,6 +210,7 @@
settingsToSave.mapControllerToMouse = mapControllerToMouse;
settingsToSave.controllerMousePointerVelocity = [NSNumber numberWithFloat:controllerMousePointerVelocity];
settingsToSave.controllerMouseExpo = [NSNumber numberWithFloat:controllerMouseExpo];
settingsToSave.softKeyboardHeight = softKeyboardHeight;
settingsToSave.rememberFoldState = rememberFoldState;
[self saveData];
}];
+1
View File
@@ -74,6 +74,7 @@
@property (nonatomic) BOOL statsOverlayEnabled;
@property (nonatomic) BOOL liftStreamViewForKeyboard;
@property (nonatomic) BOOL showKeyboardToolbar;
@property (nonatomic) CGFloat softKeyboardHeight;
@property (nonatomic) BOOL unlockDisplayOrientation;
@property (nonatomic) BOOL enableGraphs;
@property (nonatomic) BOOL enableFrameTimebase;
+1
View File
@@ -119,6 +119,7 @@
self.slideToSettingsDistance = settings.slideToSettingsDistance;
self.liftStreamViewForKeyboard = settings.liftStreamViewForKeyboard;
self.showKeyboardToolbar = settings.showKeyboardToolbar;
self.softKeyboardHeight = settings.softKeyboardHeight;
self.touchMoveEventInterval = settings.touchMoveEventInterval;
self.touchPointerVelocityFactor = settings.touchPointerVelocityFactor;
self.mousePointerVelocityFactor = settings.mousePointerVelocityFactor;
+21 -6
View File
@@ -69,6 +69,8 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5;
#if defined(__IPHONE_16_1) || defined(__TVOS_16_1)
UIHoverGestureRecognizer *stylusHoverRecognizer;
#endif
CGFloat designatedSoftKeyboardHeight;
bool keyboardHeightDesignatedForLandscape;
CGFloat HeightViewLiftedTo;
UILabel* keyboardToggleTip;
@@ -116,6 +118,9 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5;
keyboardToggleTip.layer.cornerRadius = 10;
keyboardToggleTip.clipsToBounds = true;
designatedSoftKeyboardHeight = settings.softKeyboardHeight * GenericUtils.screenHeight;
keyboardHeightDesignatedForLandscape = designatedSoftKeyboardHeight != 0;
// if(settings.touchMode.intValue == NativeTouchOnly) [self addGestureRecognizer:keyboardToggleRecognizer]; //keep legacy approach in pure native mode
// else [self->streamFrameTopLayerView addGestureRecognizer:keyboardToggleRecognizer]; //add to the superview in other modes
@@ -254,13 +259,13 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5;
NSDictionary *userInfo = notification.userInfo;
// Get the keyboard size from the notification
CGRect keyboardFrame = [userInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue];
CGFloat screenHeight = CGRectGetHeight([[UIScreen mainScreen] bounds]);
CGFloat keyboardHeight = keyboardFrame.size.height;
CGFloat screenHeight = GenericUtils.screenHeight;
CGFloat totalKeyboardHeight = keyboardFrame.size.height;
CGFloat toolbarHeight = settings.showKeyboardToolbar ? GenericUtils.legacyToolbarHeight : 0;
if(keyboardHeight < screenHeight * 0.33333333333 + toolbarHeight
|| keyboardHeight > screenHeight*0.8 + toolbarHeight){
keyboardHeight = screenHeight*0.5 + toolbarHeight;
if(totalKeyboardHeight < screenHeight * 0.33333333333 + toolbarHeight
|| totalKeyboardHeight > screenHeight*0.8 + toolbarHeight){
totalKeyboardHeight = screenHeight*0.5 + toolbarHeight;
// [self toggleKeyboard];
/*
if(keyboardToggleRecognizer.lowestTouchPointHeight < screenHeight/2){
@@ -272,7 +277,17 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5;
}*/
}
HeightViewLiftedTo = keyboardHeight - keyboardToggleRecognizer.lowestTouchPointHeight + CGRectGetHeight([[UIScreen mainScreen] bounds]) * 0.15; // lift the StreamView to the height of lowest touch point of multi-finger tap gesture, while reserving the view of 1/10 screen height for remote typing.
bool useDesignatedKeyboardHeight = false;
if (@available(iOS 13.0, *)) {
useDesignatedKeyboardHeight = GenericUtils.isLandscape && keyboardHeightDesignatedForLandscape;
totalKeyboardHeight = useDesignatedKeyboardHeight ? designatedSoftKeyboardHeight+toolbarHeight : totalKeyboardHeight;
}
else {
useDesignatedKeyboardHeight = keyboardHeightDesignatedForLandscape;
totalKeyboardHeight = useDesignatedKeyboardHeight ? designatedSoftKeyboardHeight+toolbarHeight : totalKeyboardHeight;
}
HeightViewLiftedTo = totalKeyboardHeight - keyboardToggleRecognizer.lowestTouchPointHeight + GenericUtils.screenHeight * (useDesignatedKeyboardHeight ? 0.1 : 0.15); // lift the StreamView to the height of lowest touch point of multi-finger tap gesture, while reserving the view of 1/10 screen height for remote typing.
if(HeightViewLiftedTo < 0) HeightViewLiftedTo = 0; // set HeightViewLiftedTo to 0 if it is high enough and not going to be covered by keyboard.
CGRect liftedStreamFrame = self.frame;
liftedStreamFrame.origin.y -= HeightViewLiftedTo;
@@ -98,6 +98,7 @@
<attribute name="singleTapSensitivity" optional="YES" attributeType="Double" defaultValueString="1" usesScalarValueType="NO" syncable="YES"/>
<attribute name="slideToSettingsDistance" optional="YES" attributeType="Float" defaultValueString="0.2" usesScalarValueType="NO" syncable="YES"/>
<attribute name="slideToSettingsScreenEdge" optional="YES" attributeType="Integer 32" defaultValueString="2" usesScalarValueType="NO" syncable="YES"/>
<attribute name="softKeyboardHeight" attributeType="Float" defaultValueString="0" usesScalarValueType="YES" syncable="YES"/>
<attribute name="statsOverlayEnabled" attributeType="Boolean" defaultValueString="NO" usesScalarValueType="YES" syncable="YES"/>
<attribute name="statsOverlayLevel" optional="YES" attributeType="Integer 16" defaultValueString="0" usesScalarValueType="NO" syncable="YES"/>
<attribute name="swapABXYButtons" attributeType="Boolean" defaultValueString="NO" usesScalarValueType="YES" syncable="YES"/>
@@ -3167,6 +3167,29 @@
}
}
},
"Enter the relative height of the soft keyboard according to the scale (make sure app is in landscape fullscreen mode):" : {
"extractionState" : "manual",
"localizations" : {
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "按刻度输入软键盘的相对高度(请确保 App 运行在横向全屏状态):"
}
},
"zh-Hant" : {
"stringUnit" : {
"state" : "translated",
"value" : "按刻度輸入軟鍵盤的相對高度(請確保 App 運行於橫向全螢幕狀態):"
}
},
"zh-HK" : {
"stringUnit" : {
"state" : "translated",
"value" : "按刻度輸入軟鍵盤的相對高度(請確保 App 運行於橫向全螢幕狀態):"
}
}
}
},
"Enter_PIN_Msg" : {
"extractionState" : "manual",
"localizations" : {
@@ -7961,6 +7984,35 @@
}
}
},
"softKeyboardHeightStackTip" : {
"extractionState" : "manual",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "The soft keyboard height obtained automatically by the system may be unreliable (especially with third-party keyboards), which can prevent the streaming view from being properly raised. Specifying the keyboard height can resolve this issue."
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "通过系统自动获取的软键盘高度可能不可靠(尤其是第三方输入法), 导致串流画面无法正确抬升,指定软键盘高度可解决此问题。"
}
},
"zh-Hant" : {
"stringUnit" : {
"state" : "translated",
"value" : "透過系統自動取得的軟鍵盤高度可能不可靠(尤其是第三方輸入法),可能導致串流畫面無法正確抬升,指定軟鍵盤高度可解決此問題。"
}
},
"zh-HK" : {
"stringUnit" : {
"state" : "translated",
"value" : "透過系統自動取得的軟鍵盤高度可能不可靠(尤其是第三方輸入法),可能導致串流畫面無法正確抬升,指定軟鍵盤高度可解決此問題。"
}
}
}
},
"Squeeze Shortcut" : {
"extractionState" : "manual",
"localizations" : {
+82
View File
@@ -105,4 +105,86 @@ import Foundation
applyOffTintColor(sub)
}
}
static var kScaleLayerKey: UInt8 = 0
@objc static func setVerticalScale(view: UIView, show: Bool) {
// 移除旧的
if let oldLayer = objc_getAssociatedObject(view, &kScaleLayerKey) as? CALayer {
oldLayer.removeFromSuperlayer()
objc_setAssociatedObject(view, &kScaleLayerKey, nil, .OBJC_ASSOCIATION_RETAIN_NONATOMIC)
}
guard show else { return }
let container = CALayer()
container.frame = view.bounds
container.contentsScale = UIScreen.main.scale
let step: CGFloat = 0.05
let totalSteps = Int(1.0 / step)
let path = UIBezierPath()
for i in 0...totalSteps {
let value = CGFloat(i) * step
let y = view.bounds.height * (1.0 - value)
let isMajor = i % 2 == 0
let lineLength: CGFloat = isMajor ? 10 : 5
// 刻度线
path.move(to: CGPoint(x: 0, y: y))
path.addLine(to: CGPoint(x: lineLength, y: y))
// 数值
if true {
let t = CATextLayer()
t.contentsScale = UIScreen.main.scale
t.font = UIFont.systemFont(ofSize: 13, weight: .medium)
t.fontSize = 13
t.foregroundColor = UIColor.red.cgColor
t.backgroundColor = ThemeManager.menuBackgroundColor.cgColor
t.alignmentMode = .left
t.string = String(format: "%.2f", value)
t.frame = CGRect(x: lineLength + 2, y: y - 7, width: 30, height: 14)
container.addSublayer(t)
}
}
let shape = CAShapeLayer()
shape.path = path.cgPath
shape.strokeColor = UIColor.red.cgColor
shape.lineWidth = 1
container.addSublayer(shape)
view.layer.addSublayer(container)
objc_setAssociatedObject(view, &kScaleLayerKey, container, .OBJC_ASSOCIATION_RETAIN_NONATOMIC)
}
@objc static func toCGFloat(_ str: String) -> CGFloat {
return CGFloat(Double(str) ?? 0)
}
@available(iOS 13.0, *)
@objc static func isLandscape() -> Bool {
guard let windowScene = UIApplication.shared.connectedScenes
.compactMap({ $0 as? UIWindowScene })
.first(where: { $0.activationState == .foregroundActive })
else {
return false
}
return windowScene.interfaceOrientation.isLandscape
}
@objc static var screenWidth: CGFloat {
return UIScreen.main.bounds.width
}
@objc static var screenHeight: CGFloat {
return UIScreen.main.bounds.height
}
}
@@ -16,7 +16,7 @@
#import "CustomEdgeSlideGestureRecognizer.h"
#import "MenuSectionView.h"
@interface SettingsViewController : UIViewController <RearNavigationBarMenuDelegate, MenuSectionDelegate, MicHandlerDelegate>
@interface SettingsViewController : UIViewController <RearNavigationBarMenuDelegate, MenuSectionDelegate, MicHandlerDelegate, UITextFieldDelegate>
@property (strong, nonatomic) IBOutlet UINavigationBar *navigationBar;
@property (strong, nonatomic) UIStackView *parentStack;
@@ -216,6 +216,9 @@
@property (strong, nonatomic) IBOutlet UIStackView *passthroughGesturesStack;
@property (strong, nonatomic) IBOutlet UISwitch *passthroughGesturesSwitch;
@property (weak, nonatomic) IBOutlet UIStackView *softKeyboardHeightStack;
@property (weak, nonatomic) IBOutlet UISwitch *softKeyboardHeightSwitch;
@property (strong, nonatomic) IBOutlet UIStackView *controllerToMouseStack;
@property (strong, nonatomic) IBOutlet UISwitch *controllerToMouseSwitch;
@@ -255,7 +258,6 @@
@property (weak, nonatomic) IBOutlet UIStackView *trackTouchPointStack;
@property (weak, nonatomic) IBOutlet UISwitch *trackTouchPointSwitch;
@property (strong, nonatomic) IBOutlet UIStackView *testStack;
@@ -33,9 +33,11 @@
NSInteger _bitrate;
NSInteger _lastSelectedResolutionIndex;
CGFloat softKeyboardHeight;
bool settingsViewJustLoaded;
bool settingsViewJustExpanded;
bool settingsViewAlreadyAppeared;
bool autoPopKeyboard;
uint16_t oswLayoutFingers;
CustomEdgeSlideGestureRecognizer *slideToCloseSettingsViewRecognizer;
NSMutableDictionary *_settingStackDict;
@@ -568,6 +570,7 @@ BOOL isCustomResolution(int resolutionSelected) {
settingsViewJustExpanded = false;
settingsViewAlreadyAppeared = true;
autoPopKeyboard = true;
}
- (void)viewWillDisappear:(BOOL)animated{
@@ -959,6 +962,7 @@ BOOL isCustomResolution(int resolutionSelected) {
[self addSetting:self.optimizeGamesStack ofId:@"optimizeGamesStack" withInfoTag:YES withDynamicLabel:NO to:otherSection];
[self addSetting:self.multiControllerStack ofId:@"multiControllerStack" withInfoTag:NO withDynamicLabel:NO to:otherSection];
[self addSetting:self.softKeyboardToolbarStack ofId:@"softKeyboardToolbarStack" withInfoTag:NO withDynamicLabel:NO to:otherSection];
[self addSetting:self.softKeyboardHeightStack ofId:@"softKeyboardHeightStack" withInfoTag:YES withDynamicLabel:NO to:otherSection];
[self addSetting:self.rememberFoldStateStack ofId:@"rememberFoldStateStack" withInfoTag:NO withDynamicLabel:NO to:otherSection];
[otherSection addToParentStack:_parentStack];
@@ -1527,6 +1531,10 @@ BOOL isCustomResolution(int resolutionSelected) {
showOnlineDocAction = true;
onlineDocLink = [LocalizationHelper localizedStringForKey:@"PencilProPackURL"];
}
if([sender.superview.accessibilityIdentifier isEqualToString: @"softKeyboardHeightStack"]){
tipText = [LocalizationHelper localizedStringForKey:@"softKeyboardHeightStackTip"];
showOnlineDocAction = false;
}
UIAlertController *tipsAlertController = [UIAlertController alertControllerWithTitle: [LocalizationHelper localizedStringForKey:@"Tips"] message:tipText preferredStyle:UIAlertControllerStyleAlert];
@@ -2070,6 +2078,11 @@ BOOL isCustomResolution(int resolutionSelected) {
// showkeyboard toolbar setting
[self.softKeyboardToolbarSwitch setOn:self->tempSettings.showKeyboardToolbar];// Load old setting
self->softKeyboardHeight = self->tempSettings.softKeyboardHeight;
[self.softKeyboardHeightSwitch setOn:self->softKeyboardHeight!=0];// Load old setting
[self.softKeyboardHeightSwitch addTarget:self action:@selector(softKeyboardHeightSwitchFlipped:) forControlEvents:UIControlEventValueChanged];
// reverse mouse wheel direction setting
[self.reverseMouseWheelDirectionSelector setSelectedSegmentIndex:self->tempSettings.reverseMouseWheelDirection ? 1 : 0];// Load old setting
@@ -2982,6 +2995,55 @@ BOOL isCustomResolution(int resolutionSelected) {
else [self pinchGestureSwitchFlipped:_pinchGestureSwitch];
}
- (void)softKeyboardHeightSwitchFlipped:(UISwitch* )sender{
if(sender.isOn && !settingsViewJustLoaded){
autoPopKeyboard = false;
[GenericUtils setVerticalScaleWithView:self.view show:true];
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:[LocalizationHelper localizedStringForKey:@""]
message:[LocalizationHelper localizedStringForKey:@"Enter the relative height of the soft keyboard according to the scale (make sure app is in landscape fullscreen mode):"]
preferredStyle:UIAlertControllerStyleAlert];
[alertController addTextFieldWithConfigurationHandler:^(UITextField *textField) {
textField.placeholder = [LocalizationHelper localizedStringForKey:@"e.g. 0.45"];
textField.keyboardType = UIKeyboardTypeASCIICapable;
textField.autocorrectionType = UITextAutocorrectionTypeNo;
textField.spellCheckingType = UITextSpellCheckingTypeNo;
textField.delegate = self;
textField.text = self->softKeyboardHeight == 0 ? nil : [NSString stringWithFormat:@"%.2f", self->softKeyboardHeight];
}];
UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:[LocalizationHelper localizedStringForKey:@"Cancel"]
style:UIAlertActionStyleCancel
handler:^(UIAlertAction *action) {
[GenericUtils setVerticalScaleWithView:self.view show:false];
[sender setOn:self->softKeyboardHeight!=0];
self->autoPopKeyboard = true;
}];
UIAlertAction *okAction = [UIAlertAction actionWithTitle:[LocalizationHelper localizedStringForKey:@"OK"]
style:UIAlertActionStyleDefault
handler:^(UIAlertAction *action) {
self->softKeyboardHeight = [GenericUtils toCGFloat:alertController.textFields[0].text];
[GenericUtils setVerticalScaleWithView:self.view show:false];
[sender setOn:self->softKeyboardHeight!=0];
self->autoPopKeyboard = true;
}];
[alertController addAction:cancelAction];
[alertController addAction:okAction];
[self presentViewController:alertController animated:YES completion:nil];
}
}
// UITextFieldDelegate
- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField {
if (autoPopKeyboard) {
return YES;
} else {
autoPopKeyboard = YES;
return NO;
}
}
- (void)pinchGestureSwitchFlipped:(UISwitch* )sender{
[self setHidden:!sender.isOn forStack:_pinchSensitivityStack];
[self setHidden:!sender.isOn forStack:_ctrlDownForPinchStack];
@@ -3690,6 +3752,7 @@ BOOL isCustomResolution(int resolutionSelected) {
NSInteger controllerGyroSwitchMode = self.controllerGyroSwitchButtonSetter.selectedSegmentIndex;
BOOL enableFrameTimebase = false;
BOOL asyncFrameDequeue = self.asyncFrameDequeueSwitch.isOn;
CGFloat softKeyboardHeight = self.softKeyboardHeightSwitch.isOn ? self->softKeyboardHeight : 0;
NSInteger backgroundSessionTimer = self.backgroundSessionTimerSlider.value == self.backgroundSessionTimerSlider.maximumValue ? (uint32_t) INT16_MAX : (uint32_t)self.backgroundSessionTimerSlider.value;
[dataMan saveSettings:currentSettings
@@ -3766,6 +3829,7 @@ BOOL isCustomResolution(int resolutionSelected) {
enableFrameTimebase:enableFrameTimebase
asyncFrameDequeue:asyncFrameDequeue
sdrPerformanceWorkaround:sdrPerformanceWorkaround
softKeyboardHeight:softKeyboardHeight
backgroundSessionTimer:backgroundSessionTimer];
}
+36 -3
View File
@@ -1657,6 +1657,36 @@
}
}
},
"Bue-gF-hRI.text" : {
"comment" : "Class = \"UILabel\"; text = \"Designate Soft Keyboard Height\"; ObjectID = \"Bue-gF-hRI\";",
"extractionState" : "extracted_with_value",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "new",
"value" : "Designate Soft Keyboard Height"
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "needs_review",
"value" : "指定软键盘高度"
}
},
"zh-Hant" : {
"stringUnit" : {
"state" : "needs_review",
"value" : "指定軟鍵盤高度"
}
},
"zh-HK" : {
"stringUnit" : {
"state" : "needs_review",
"value" : "指定軟鍵盤高度"
}
}
}
},
"bVv-CW-kN8.segmentTitles[0]" : {
"comment" : "Class = \"UISegmentedControl\"; bVv-CW-kN8.segmentTitles[0] = \"Regular\"; ObjectID = \"bVv-CW-kN8\";",
"extractionState" : "extracted_with_value",
@@ -2297,7 +2327,8 @@
"value" : "關閉"
}
}
}
},
"shouldTranslate" : false
},
"dpd-Bw-aHE.segmentTitles[1]" : {
"comment" : "Class = \"UISegmentedControl\"; dpd-Bw-aHE.segmentTitles[1] = \"Yes\"; ObjectID = \"dpd-Bw-aHE\";",
@@ -2327,7 +2358,8 @@
"value" : "啟用"
}
}
}
},
"shouldTranslate" : false
},
"dqh-nl-heL.title" : {
"comment" : "Class = \"UINavigationItem\"; title = \"Title\"; ObjectID = \"dqh-nl-heL\";",
@@ -4768,7 +4800,8 @@
"value" : "螢幕小工具佈局"
}
}
}
},
"shouldTranslate" : false
},
"q78-aY-mIe.text" : {
"comment" : "Class = \"UILabel\"; text = \"Disable Hovering\"; ObjectID = \"q78-aY-mIe\";",
+30
View File
@@ -3091,6 +3091,36 @@
}
}
},
"Mhe-jU-8hh.text" : {
"comment" : "Class = \"UILabel\"; text = \"Designate Soft Keyboard Height\"; ObjectID = \"Mhe-jU-8hh\";",
"extractionState" : "extracted_with_value",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "new",
"value" : "Designate Soft Keyboard Height"
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "指定软键盘高度"
}
},
"zh-Hant" : {
"stringUnit" : {
"state" : "translated",
"value" : "指定軟鍵盤高度"
}
},
"zh-HK" : {
"stringUnit" : {
"state" : "translated",
"value" : "指定軟鍵盤高度"
}
}
}
},
"MMc-Yp-e6i.text" : {
"comment" : "Class = \"UILabel\"; text = \"Async Native Touch\"; ObjectID = \"MMc-Yp-e6i\";",
"extractionState" : "extracted_with_value",