- make dPad, select, start OSC button on-screen widgets rectangle

- on screen control & widget size factor up to 800%
- configurable borderWidth for on-screen widget views
stage manager version
This commit is contained in:
TrueZhuangjia
2025-02-10 00:52:56 +08:00
parent ca04c62ecd
commit 4d4ab333f4
13 changed files with 161 additions and 39 deletions
+15 -8
View File
@@ -868,32 +868,32 @@ ICAgICAgICAgICAgICA
<constraint firstItem="YLK-IE-ajS" firstAttribute="centerX" secondItem="fZU-G0-fgM" secondAttribute="centerX" id="xm7-a0-8G7"/>
</constraints>
</view>
<slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="1" minValue="0.59999999999999998" maxValue="3.8999999999999999" id="Efn-Si-TPp" userLabel="Widget Size Slider">
<slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="1" minValue="0.59999999999999998" maxValue="6" id="Efn-Si-TPp" userLabel="Widget Size Slider">
<rect key="frame" x="205" y="87" width="420" height="31"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" systemColor="secondaryLabelColor"/>
<color key="tintColor" red="0.6716768742" green="0.61711704730000005" blue="0.99902987480000005" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</slider>
<slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="1" minValue="0.59999999999999998" maxValue="3.8999999999999999" id="ZOF-sL-e7p" userLabel="Widget Height Slider">
<slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="1" minValue="0.59999999999999998" maxValue="6" id="ZOF-sL-e7p" userLabel="Widget Height Slider">
<rect key="frame" x="205" y="122" width="420" height="31"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" systemColor="secondaryLabelColor"/>
<color key="tintColor" red="0.6716768742" green="0.61711704730000005" blue="0.99902987480000005" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</slider>
<slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="0.83299999999999996" minValue="0.23000000000000001" maxValue="0.999" id="ZLL-pE-iZh" userLabel="Widget Alpha Slider">
<rect key="frame" x="205" y="157" width="420" height="31"/>
<slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="0.83299999999999996" minValue="0.001" maxValue="0.999" id="ZLL-pE-iZh" userLabel="Widget Alpha Slider">
<rect key="frame" x="205" y="157" width="217" height="31"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" systemColor="secondaryLabelColor"/>
<color key="tintColor" red="0.6716768742" green="0.61711704730000005" blue="0.99902987480000005" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</slider>
<slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="1" minValue="0.0" maxValue="6" id="FRZ-xP-x2r">
<rect key="frame" x="205" y="192" width="420" height="31"/>
<slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="1" minValue="0.0" maxValue="8" id="FRZ-xP-x2r">
<rect key="frame" x="205" y="192" width="591" height="31"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" systemColor="secondaryLabelColor"/>
<color key="tintColor" red="0.6716768742" green="0.61711704730000005" blue="0.99902987480000005" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</slider>
<label opaque="NO" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Profile:" textAlignment="center" lineBreakMode="tailTruncation" adjustsFontSizeToFit="NO" id="cRV-Xw-CVi">
<rect key="frame" x="632" y="87" width="163" height="102"/>
<rect key="frame" x="631" y="87" width="163" height="67"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" red="0.38551661729999998" green="0.28289704380000003" blue="0.61853601300000005" alpha="0.28999999999999998" colorSpace="custom" customColorSpace="sRGB"/>
<color key="tintColor" red="0.81533776120000001" green="0.85979419950000002" blue="0.91372549020000005" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
@@ -902,7 +902,13 @@ ICAgICAgICAgICAgICA
<nil key="highlightedColor"/>
</label>
<slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="120" minValue="0.0" maxValue="350" id="oc7-kh-RVH">
<rect key="frame" x="205" y="227" width="420" height="31"/>
<rect key="frame" x="205" y="227" width="591" height="31"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" systemColor="secondaryLabelColor"/>
<color key="tintColor" red="0.6716768742" green="0.61711704730000005" blue="0.99902987480000005" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</slider>
<slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" minValue="0.0" maxValue="8" id="CCy-fw-7og" userLabel="Widget Border Width Slider">
<rect key="frame" x="590" y="157" width="206" height="31"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" systemColor="secondaryLabelColor"/>
<color key="tintColor" red="0.6716768742" green="0.61711704730000005" blue="0.99902987480000005" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
@@ -929,6 +935,7 @@ ICAgICAgICAgICAgICA
<outlet property="trashCanButton" destination="qJs-n8-eV7" id="ubK-qm-Cox"/>
<outlet property="undoButton" destination="F7X-l4-cl3" id="vAI-XQ-hZw"/>
<outlet property="widgetAlphaSlider" destination="ZLL-pE-iZh" id="5OX-P6-YKt"/>
<outlet property="widgetBorderWidthSlider" destination="CCy-fw-7og" id="wio-Ly-MMR"/>
<outlet property="widgetHeightSlider" destination="ZOF-sL-e7p" id="OHK-5i-3RY"/>
<outlet property="widgetSizeSlider" destination="Efn-Si-TPp" id="CgK-cC-Yo0"/>
</connections>
+23 -15
View File
@@ -732,14 +732,14 @@ ICAgICAgICAgICAgIA
<viewControllerLayoutGuide type="bottom" id="TWA-bF-hnk"/>
</layoutGuides>
<view key="view" opaque="NO" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" id="Mwx-9q-yJJ">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<rect key="frame" x="0.0" y="0.0" width="650" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Jnu-63-bcf" customClass="ToolBarContainerView">
<rect key="frame" x="0.0" y="0.0" width="414" height="50"/>
<rect key="frame" x="0.0" y="0.0" width="650" height="50"/>
<subviews>
<stackView opaque="NO" contentMode="scaleAspectFill" alignment="center" spacing="70" translatesAutoresizingMaskIntoConstraints="NO" id="4he-pe-kYB">
<rect key="frame" x="-58" y="0.0" width="530" height="50"/>
<rect key="frame" x="60" y="0.0" width="530" height="50"/>
<subviews>
<button opaque="NO" tag="20" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="dhG-Fo-0GK" userLabel="Trash">
<rect key="frame" x="0.0" y="0.0" width="50" height="50"/>
@@ -835,7 +835,7 @@ ICAgICAgICAgICAgIA
</constraints>
</stackView>
<view alpha="0.89999997615814209" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Zll-IP-PFt" userLabel="Chevron View">
<rect key="frame" x="181" y="50" width="52" height="25"/>
<rect key="frame" x="299" y="50" width="52" height="25"/>
<subviews>
<imageView clipsSubviews="YES" contentMode="center" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="ChevronCompactUp" translatesAutoresizingMaskIntoConstraints="NO" id="76O-3K-aa8">
<rect key="frame" x="0.0" y="0.0" width="52" height="25"/>
@@ -871,32 +871,32 @@ ICAgICAgICAgICAgIA
<action selector="closeTapped:" destination="ZYS-Zm-PJs" eventType="touchUpInside" id="U8V-Ry-ym9"/>
</connections>
</button>
<slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="1" minValue="0.59999999999999998" maxValue="3.8999999999999999" id="DGw-22-vUn" userLabel="Slider">
<slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="1" minValue="0.59999999999999998" maxValue="6" id="DGw-22-vUn" userLabel="Slider">
<rect key="frame" x="39" y="82" width="337" height="31"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" systemColor="secondaryLabelColor"/>
<color key="tintColor" red="0.6716768742" green="0.61711704730000005" blue="0.99902987480000005" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</slider>
<slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="1" minValue="0.59999999999999998" maxValue="3.8999999999999999" id="VLi-Mk-ESg" userLabel="Slider">
<slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="1" minValue="0.59999999999999998" maxValue="6" id="VLi-Mk-ESg" userLabel="Slider">
<rect key="frame" x="39" y="117" width="337" height="31"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" systemColor="secondaryLabelColor"/>
<color key="tintColor" red="0.6716768742" green="0.61711704730000005" blue="0.99902987480000005" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</slider>
<slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="0.83299999999999996" minValue="0.23000000000000001" maxValue="0.999" id="P6S-oW-Ewb" userLabel="Slider">
<rect key="frame" x="39" y="152" width="337" height="31"/>
<slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="0.83299999999999996" minValue="0.001" maxValue="0.999" id="P6S-oW-Ewb" userLabel="Slider">
<rect key="frame" x="39" y="152" width="177" height="31"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" systemColor="secondaryLabelColor"/>
<color key="tintColor" red="0.6716768742" green="0.61711704730000005" blue="0.99902987480000005" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</slider>
<slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="1" minValue="0.0" maxValue="6" id="QXI-Ex-JNV" userLabel="Slider">
<rect key="frame" x="39" y="187" width="337" height="31"/>
<slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" minValue="0.0" maxValue="8" id="61X-O2-FOs" userLabel="Slider">
<rect key="frame" x="380" y="152" width="131" height="31"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" systemColor="secondaryLabelColor"/>
<color key="tintColor" red="0.6716768742" green="0.61711704730000005" blue="0.99902987480000005" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</slider>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Profile:" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="yJC-bq-EOU">
<rect key="frame" x="247" y="82" width="147" height="100"/>
<rect key="frame" x="380" y="83" width="131" height="65"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" red="0.38551661729999998" green="0.28289704380000003" blue="0.61853601300000005" alpha="0.28999999999999998" colorSpace="custom" customColorSpace="sRGB"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="18"/>
@@ -904,7 +904,13 @@ ICAgICAgICAgICAgIA
<nil key="highlightedColor"/>
</label>
<slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="120" minValue="0.0" maxValue="350" id="OaL-Ph-J4n" userLabel="Slider">
<rect key="frame" x="39" y="222" width="337" height="31"/>
<rect key="frame" x="39" y="222" width="472" height="31"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" systemColor="secondaryLabelColor"/>
<color key="tintColor" red="0.6716768742" green="0.61711704730000005" blue="0.99902987480000005" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</slider>
<slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="1" minValue="0.0" maxValue="8" id="QXI-Ex-JNV" userLabel="Slider">
<rect key="frame" x="38" y="187" width="473" height="31"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" systemColor="secondaryLabelColor"/>
<color key="tintColor" red="0.6716768742" green="0.61711704730000005" blue="0.99902987480000005" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
@@ -919,6 +925,7 @@ ICAgICAgICAgICAgIA
<constraint firstItem="Jnu-63-bcf" firstAttribute="top" secondItem="Mwx-9q-yJJ" secondAttribute="top" id="wNr-7F-S0i" userLabel="Toolbar Top Constraint iPhone"/>
</constraints>
</view>
<size key="freeformSize" width="650" height="896"/>
<connections>
<outlet property="chevronImageView" destination="76O-3K-aa8" id="yGv-fM-Ohf"/>
<outlet property="chevronView" destination="Zll-IP-PFt" id="MGR-C0-h57"/>
@@ -931,13 +938,14 @@ ICAgICAgICAgICAgIA
<outlet property="trashCanButton" destination="dhG-Fo-0GK" id="dv6-TN-2Bj"/>
<outlet property="undoButton" destination="Pdg-l4-BvF" id="emD-GI-v2v"/>
<outlet property="widgetAlphaSlider" destination="P6S-oW-Ewb" id="cTe-T8-LwU"/>
<outlet property="widgetBorderWidthSlider" destination="61X-O2-FOs" id="Geb-Oq-VtU"/>
<outlet property="widgetHeightSlider" destination="VLi-Mk-ESg" id="6O9-gp-VFZ"/>
<outlet property="widgetSizeSlider" destination="DGw-22-vUn" id="iEF-jl-gJ0"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="ORo-HP-JDj" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="2640.579710144928" y="1372.7678571428571"/>
<point key="canvasLocation" x="1569.5652173913045" y="1372.7678571428571"/>
</scene>
<!--Profiles Table View Controller-->
<scene sceneID="C7c-yg-gQK">
@@ -1012,13 +1020,13 @@ ICAgICAgICAgICAgIA
<image name="SquaresArrowUp" width="40" height="40"/>
<image name="Trash" width="40" height="40"/>
<systemColor name="secondaryLabelColor">
<color red="0.23529411764705882" green="0.23529411764705882" blue="0.2627450980392157" alpha="0.59999999999999998" colorSpace="custom" customColorSpace="sRGB"/>
<color red="0.23529411759999999" green="0.23529411759999999" blue="0.26274509800000001" alpha="0.59999999999999998" colorSpace="custom" customColorSpace="sRGB"/>
</systemColor>
<systemColor name="systemBackgroundColor">
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</systemColor>
<systemColor name="tintColor">
<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>
</resources>
</document>
+8
View File
@@ -74,6 +74,14 @@ import UIKit
"OSCL2" : 0,
"OSCR2" : 0]
@objc public static let oscRectangleButtonCmds: [String] = [
"OSCUP",
"OSCDOWN",
"OSCLEFT",
"OSCRIGHT",
"OSCSTART",
"OSCSELECT"]
@objc public static let touchPadCmds: [String] = ["LSVPAD", "RSVPAD", "LSPAD", "RSPAD", "MOUSEPAD", "DPAD", "WASDPAD", "ARROWPAD"]
@objc public static let stickTouchPads: [String] = ["LSVPAD", "RSVPAD", "LSPAD", "RSPAD"]
@objc public static let nonVectorStickPads: [String] = ["LSPAD", "RSPAD"]
@@ -290,6 +290,7 @@ static NSMutableDictionary *OnScreenWidgetViewsDict;
buttonState.widthFactor = widgetView.widthFactor;
buttonState.heightFactor = widgetView.heightFactor;
buttonState.backgroundAlpha = widgetView.backgroundAlpha;
buttonState.borderWidth = widgetView.borderWidth;
buttonState.sensitivityFactor = widgetView.sensitivityFactor;
buttonState.stickIndicatorXOffset = widgetView.stickIndicatorXOffset;
@@ -27,6 +27,7 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, assign) NSTimeInterval timestamp;
@property (nonatomic, assign) CGFloat widthFactor; // for OnScreenWidgetView
@property (nonatomic, assign) CGFloat heightFactor; // for OnScreenWidgetView
@property (nonatomic, assign) CGFloat borderWidth; // for OnScreenWidgetView
@property (nonatomic, assign) CGFloat sensitivityFactor; // for OnScreenWidgetView
@property (nonatomic, assign) CGFloat stickIndicatorXOffset; // for OnScreenWidgetView
@@ -39,6 +39,7 @@
[encoder encodeFloat:self.stickIndicatorXOffset forKey:@"stickIndicatorOffset"];
[encoder encodeFloat:self.oscLayerSizeFactor forKey:@"oscLayerSizeFactor"];
[encoder encodeFloat:self.backgroundAlpha forKey:@"backgroundAlpha"];
[encoder encodeFloat:self.borderWidth forKey:@"borderWidth"];
}
- (id) initWithCoder:(NSCoder*)decoder {
@@ -55,6 +56,7 @@
self.stickIndicatorXOffset = [decoder decodeFloatForKey:@"stickIndicatorOffset"];
self.oscLayerSizeFactor = [decoder decodeFloatForKey:@"oscLayerSizeFactor"];
self.backgroundAlpha = [decoder decodeFloatForKey:@"backgroundAlpha"];
self.borderWidth = [decoder decodeFloatForKey:@"borderWidth"];
}
return self;
}
+2 -2
View File
@@ -1894,9 +1894,9 @@ static float L3_Y;
// CALayer* superLayer = layer.superlayer;
// if(layerBeingDragged.name == @"")
CGFloat targetAlpha;
targetAlpha = alpha;
if(alpha < 0.23) targetAlpha = 0.23;
if(alpha == 0.0 || alpha == 1.0) targetAlpha = 5.0f/6.0f; // invalid alpha value
else targetAlpha = alpha;
NSLog(@"alphas: %f",targetAlpha);
+19 -9
View File
@@ -27,6 +27,7 @@ import UIKit
@objc public var pressed: Bool
@objc public var widthFactor: CGFloat = 1.0
@objc public var heightFactor: CGFloat = 1.0
@objc public var borderWidth: CGFloat = 0.0
@objc public var backgroundAlpha: CGFloat = 0.5
@objc public var latestTouchLocation: CGPoint
@objc public var selfViewOnTheRight: Bool = false
@@ -153,16 +154,24 @@ import UIKit
OnScreenWidgetView.editMode = enabled
}
@objc public func adjustButtonTransparency(alpha: CGFloat){
@objc public func adjustTransparency(alpha: CGFloat){
if alpha != 0 {
self.backgroundAlpha = alpha
}
else{
self.backgroundAlpha = 0.5
// self.backgroundAlpha = 0.5
self.backgroundAlpha = alpha
}
self.tweakAlpha()
}
@objc public func adjustBorder(width: CGFloat){
self.borderWidth = width
// self.layer.borderWidth = borderWidth
// if CommandManager.touchPadCmds.contains(self.keyString) && width == 0 {self.layer.borderWidth = 1}
setupView()
}
@objc public func resizeWidgetView(){
guard let superview = superview else { return }
@@ -173,7 +182,6 @@ import UIKit
// To resize the button, we must set this to false temporarily
translatesAutoresizingMaskIntoConstraints = false
// replace invalid factor values
if self.widthFactor == 0 {self.widthFactor = 1.0}
if self.heightFactor == 0 {self.heightFactor = 1.0}
@@ -207,7 +215,7 @@ import UIKit
}
private func changeAndActivateContraints(){
if CommandManager.oscButtonMappings.keys.contains(self.keyString){ // we'll make custom osc buttons round & smaller
if CommandManager.oscButtonMappings.keys.contains(self.keyString) && !CommandManager.oscRectangleButtonCmds.contains(self.keyString){ // we'll make custom osc buttons round & smaller
NSLayoutConstraint.activate([
self.widthAnchor.constraint(equalToConstant: 60 * self.widthFactor),
self.heightAnchor.constraint(equalToConstant: 60 * self.heightFactor),])
@@ -244,19 +252,21 @@ import UIKit
self.translatesAutoresizingMaskIntoConstraints = true // this is mandatory to prevent unexpected key view location change
self.layer.cornerRadius = 20
self.layer.borderWidth = 1
self.layer.cornerRadius = 16
self.layer.borderWidth = self.borderWidth
self.tweakAlpha()
if CommandManager.oscButtonMappings.keys.contains(self.keyString){ //make oscButtons round and no border
if CommandManager.oscButtonMappings.keys.contains(self.keyString) && !CommandManager.oscRectangleButtonCmds.contains(self.keyString){ //make oscButtons round and no border
self.layer.cornerRadius = self.frame.width/2
self.layer.borderWidth = 0
// self.layer.borderWidth = self.borderWidth
label.minimumScaleFactor = 0.15 // Adjust the scale factor for oscButtons
label.font = UIFont.boldSystemFont(ofSize: 22)
}
if CommandManager.touchPadCmds.contains(self.keyString){
if(self.borderWidth < 1) {self.layer.borderWidth = 1}
else {self.layer.borderWidth = self.borderWidth}
label.text = "" // make touchPad display no text
if OnScreenWidgetView.editMode { //display label in edit mode to make the pad more visible
label.text = self.keyString
@@ -634,7 +644,7 @@ import UIKit
private func setupButtonDownVisualEffectLayer() {
self.buttonDownVisualEffectWidth = 8.6
if CommandManager.oscButtonMappings.keys.contains(self.keyString) {self.buttonDownVisualEffectWidth = 15.3} // wider visual effect for osc buttons
if CommandManager.oscButtonMappings.keys.contains(self.keyString) && !CommandManager.oscRectangleButtonCmds.contains(self.keyString) {self.buttonDownVisualEffectWidth = 15.3} // wider visual effect for osc buttons
// Set the frame to be larger than the view to expand outward
buttonDownVisualEffectLayer.borderWidth = 0 // set this 0 to hide the visual effect first
+3 -1
View File
@@ -401,13 +401,15 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5;
widgetView.translatesAutoresizingMaskIntoConstraints = NO; // weird but this is mandatory, or you will find no key views added to the right place
widgetView.widthFactor = buttonState.widthFactor;
widgetView.heightFactor = buttonState.heightFactor;
widgetView.borderWidth = buttonState.borderWidth;
widgetView.sensitivityFactor = buttonState.sensitivityFactor;
widgetView.stickIndicatorXOffset = buttonState.stickIndicatorXOffset;
// Add the widgetView to the view controller's view
[self->streamFrameTopLayerView addSubview:widgetView]; // add keyboard button to the stream frame view. must add it to the target view before setting location.
[widgetView setLocationWithXOffset:buttonState.position.x yOffset:buttonState.position.y];
[widgetView resizeWidgetView]; // resize must be called after relocation
[widgetView adjustButtonTransparencyWithAlpha:buttonState.backgroundAlpha];
[widgetView adjustTransparencyWithAlpha:buttonState.backgroundAlpha];
[widgetView adjustBorderWithWidth:buttonState.borderWidth];
}
}
}
+1 -1
View File
@@ -74,7 +74,7 @@
<string>armv7</string>
</array>
<key>UIRequiresFullScreen</key>
<true/>
<false/>
<key>UIStatusBarHidden</key>
<true/>
<key>UISupportedInterfaceOrientations</key>
@@ -283,6 +283,52 @@
}
}
},
"Border Width" : {
"extractionState" : "manual",
"localizations" : {
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "边界宽度"
}
},
"zh-Hant" : {
"stringUnit" : {
"state" : "translated",
"value" : "边界宽度"
}
},
"zh-HK" : {
"stringUnit" : {
"state" : "translated",
"value" : "边界宽度"
}
}
}
},
"Border Width: %.2f" : {
"extractionState" : "manual",
"localizations" : {
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "边界宽度: %.2f"
}
},
"zh-Hant" : {
"stringUnit" : {
"state" : "translated",
"value" : "边界宽度: %.2f"
}
},
"zh-HK" : {
"stringUnit" : {
"state" : "translated",
"value" : "边界宽度: %.2f"
}
}
}
},
"Cancel" : {
"extractionState" : "manual",
"localizations" : {
@@ -42,6 +42,7 @@ NS_ASSUME_NONNULL_BEGIN
@property (strong, nonatomic) IBOutlet UISlider *widgetAlphaSlider;
@property (strong, nonatomic) IBOutlet UISlider *sensitivityFactorSlider;
@property (strong, nonatomic) IBOutlet UISlider *stickIndicatorOffsetSlider;
@property (strong, nonatomic) IBOutlet UISlider *widgetBorderWidthSlider;
@end
@@ -32,6 +32,7 @@
UILabel *widgetSizeSliderLabel;
UILabel *widgetHeightSliderLabel;
UILabel *widgetAlphaSliderLabel;
UILabel *widgetBorderWidthSliderLabel;
UILabel *sensitivitySliderLabel;
UILabel *stickIndicatorOffsetSliderLabel;
UILabel *stickIndicatorOffsetExplain;
@@ -78,6 +79,7 @@
widgetView.timestamp = buttonState.timestamp; // will be set as key in in the dict.
widgetView.widthFactor = buttonState.widthFactor;
widgetView.heightFactor = buttonState.heightFactor;
widgetView.borderWidth = buttonState.borderWidth;
widgetView.sensitivityFactor = buttonState.sensitivityFactor;
widgetView.stickIndicatorXOffset = buttonState.stickIndicatorXOffset;
// widgetView.backgroundAlpha = buttonState.backgroundAlpha;
@@ -85,7 +87,8 @@
[self.view addSubview:widgetView];
[widgetView setLocationWithXOffset:buttonState.position.x yOffset:buttonState.position.y];
[widgetView resizeWidgetView]; // resize must be called after relocation
[widgetView adjustButtonTransparencyWithAlpha:buttonState.backgroundAlpha];
[widgetView adjustTransparencyWithAlpha:buttonState.backgroundAlpha];
[widgetView adjustBorderWithWidth:buttonState.borderWidth];
[self.OnScreenWidgetViewsDict setObject:widgetView forKey:@(widgetView.timestamp)];
}
}
@@ -103,6 +106,7 @@
widgetSizeSliderLabel = [[UILabel alloc] init];
widgetHeightSliderLabel = [[UILabel alloc] init];
widgetAlphaSliderLabel = [[UILabel alloc] init];
widgetBorderWidthSliderLabel = [[UILabel alloc] init];
sensitivitySliderLabel = [[UILabel alloc] init];
stickIndicatorOffsetSliderLabel = [[UILabel alloc] init];
stickIndicatorOffsetExplain = [[UILabel alloc] init];
@@ -399,6 +403,7 @@
[self.widgetSizeSlider setValue: self->selectedWidgetView.widthFactor];
[self.widgetHeightSlider setValue: self->selectedWidgetView.heightFactor];
[self.widgetAlphaSlider setValue: self->selectedWidgetView.backgroundAlpha];
[self.widgetBorderWidthSlider setValue:self->selectedWidgetView.borderWidth];
NSSet *stickAndMouseTouchpads = [NSSet setWithObjects:@"LSPAD", @"RSPAD", @"LSVPAD", @"RSVPAD", @"MOUSEPAD", nil];
NSSet *nonVectorStickPads = [NSSet setWithObjects:@"LSPAD", @"RSPAD", nil];
@@ -425,6 +430,7 @@
[widgetSizeSliderLabel setText:[LocalizationHelper localizedStringForKey:@"Widget Size: %.2f", self->selectedWidgetView.widthFactor]];
[widgetHeightSliderLabel setText:[LocalizationHelper localizedStringForKey:@"Widget Height: %.2f", self->selectedWidgetView.heightFactor]];
[widgetAlphaSliderLabel setText:[LocalizationHelper localizedStringForKey:@"Widget Alpha: %.2f", self->selectedWidgetView.backgroundAlpha]];
[widgetBorderWidthSliderLabel setText:[LocalizationHelper localizedStringForKey:@"Border Width: %.2f", self->selectedWidgetView.borderWidth]];
}
- (void)setControllerCALayerSliderValues: (NSNotification *)notification{
@@ -473,7 +479,7 @@
[widgetHeightSliderLabel setText:[LocalizationHelper localizedStringForKey:@"Widget Height: %.2f", self.widgetHeightSlider.value]];
if(self->selectedWidgetView != nil && self->widgetViewSelected){
self->selectedWidgetView.translatesAutoresizingMaskIntoConstraints = true; // this is mandatory to prevent unexpected key view location change
if([CommandManager.oscButtonMappings.allKeys containsObject:selectedWidgetView.keyString]) return; // don't change custom osc button height
if([CommandManager.oscButtonMappings.allKeys containsObject:selectedWidgetView.keyString] && ![CommandManager.oscRectangleButtonCmds containsObject:selectedWidgetView.keyString]) return; // don't change custom osc button height, except for dPad buttons which are in rectangle shape
self->selectedWidgetView.heightFactor = self.widgetHeightSlider.value;
[self->selectedWidgetView resizeWidgetView];
}
@@ -482,7 +488,7 @@
- (void)widgetAlphaSliderMoved{
[widgetAlphaSliderLabel setText:[LocalizationHelper localizedStringForKey:@"Widget Alpha: %.2f", self.widgetAlphaSlider.value]];
if(self->selectedWidgetView != nil && self->widgetViewSelected){
[self->selectedWidgetView adjustButtonTransparencyWithAlpha:self.widgetAlphaSlider.value];
[self->selectedWidgetView adjustTransparencyWithAlpha:self.widgetAlphaSlider.value];
}
if(self->selectedControllerLayer != nil && self->controllerLayerSelected){
@@ -491,6 +497,14 @@
return;
}
- (void)widgetBorderWidthSliderMoved{
[widgetBorderWidthSliderLabel setText:[LocalizationHelper localizedStringForKey:@"Border Width: %.2f", self.widgetBorderWidthSlider.value]];
if(self->selectedWidgetView != nil && self->widgetViewSelected){
[self->selectedWidgetView adjustBorderWithWidth:self.widgetBorderWidthSlider.value];
}
return;
}
- (void)sensitivitySliderMoved{
[sensitivitySliderLabel setText:[LocalizationHelper localizedStringForKey:@"Sensitivity: %.2f", self.sensitivityFactorSlider.value]];
if(self->selectedWidgetView != nil && self->widgetViewSelected) self->selectedWidgetView.sensitivityFactor = self.sensitivityFactorSlider.value;
@@ -590,6 +604,27 @@
widgetAlphaSliderLabel.hidden = NO;
// border Width slider
self.widgetBorderWidthSlider.hidden = NO;
self.widgetBorderWidthSlider.frame = CGRectMake(CGRectGetMaxX(self.currentProfileLabel.frame)-self.widgetBorderWidthSlider.frame.size.width, self.widgetBorderWidthSlider.frame.origin.y, self.widgetBorderWidthSlider.frame.size.width, self.widgetBorderWidthSlider.frame.size.height);
[self.widgetBorderWidthSlider addTarget:self action:@selector(widgetBorderWidthSliderMoved) forControlEvents:(UIControlEventValueChanged)];
widgetBorderWidthSliderLabel.text = [LocalizationHelper localizedStringForKey:@"Border Width"];
widgetBorderWidthSliderLabel.font = [UIFont systemFontOfSize:18];
widgetBorderWidthSliderLabel.textColor = [UIColor whiteColor];
widgetBorderWidthSliderLabel.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5];
widgetBorderWidthSliderLabel.translatesAutoresizingMaskIntoConstraints = NO; // Disable autoresizing mask for Auto Layout
[self.view addSubview:widgetBorderWidthSliderLabel];
[NSLayoutConstraint activateConstraints:@[
// Position the label to the left of the slider
[widgetBorderWidthSliderLabel.trailingAnchor constraintEqualToAnchor:self.widgetBorderWidthSlider.leadingAnchor constant:-10],
// Align vertically with the slider
[widgetBorderWidthSliderLabel.centerYAnchor constraintEqualToAnchor:self.widgetBorderWidthSlider.centerYAnchor]
]];
widgetBorderWidthSliderLabel.hidden = NO;
// sensitivity slider
self.sensitivityFactorSlider.hidden = YES;
self.sensitivityFactorSlider.frame = CGRectMake(sliderXPosition, self.sensitivityFactorSlider.frame.origin.y, self.sensitivityFactorSlider.frame.size.width, self.sensitivityFactorSlider.frame.size.height);
@@ -610,6 +645,7 @@
]];
sensitivitySliderLabel.hidden = self.sensitivityFactorSlider.hidden;
// stick indicator offset slider
self.stickIndicatorOffsetSlider.hidden = YES;
self.stickIndicatorOffsetSlider.frame = CGRectMake(sliderXPosition, self.stickIndicatorOffsetSlider.frame.origin.y, self.stickIndicatorOffsetSlider.frame.size.width, self.stickIndicatorOffsetSlider.frame.size.height); // make this label bigger to show some tips