- feat: implementation of slidable button
This commit is contained in:
@@ -1309,7 +1309,7 @@
|
||||
</constraints>
|
||||
</view>
|
||||
<stackView opaque="NO" contentMode="scaleToFill" ambiguous="YES" axis="vertical" spacing="5" translatesAutoresizingMaskIntoConstraints="NO" id="z5Q-bW-WQ8" userLabel="widgetPanelStack" customClass="WidgetPanelStackView">
|
||||
<rect key="frame" x="325" y="156" width="650" height="343.5"/>
|
||||
<rect key="frame" x="325" y="156" width="650" height="379.5"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Profile:" textAlignment="center" lineBreakMode="tailTruncation" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="iel-xl-xd9">
|
||||
<rect key="frame" x="0.0" y="0.0" width="650" height="37"/>
|
||||
@@ -1474,7 +1474,7 @@
|
||||
</label>
|
||||
<slider clearsContextBeforeDrawing="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="0.93000000000000005" minValue="0.5" maxValue="1" translatesAutoresizingMaskIntoConstraints="NO" id="nzC-NF-fkv">
|
||||
<rect key="frame" x="158" y="0.0" width="494" height="31"/>
|
||||
<color key="tintColor" red="0.18823529410000001" green="0.69019607839999997" blue="0.78039215689999997" alpha="0.5" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<color key="tintColor" red="0.34534250659404359" green="0.68327885717542713" blue="0.76859849691390991" alpha="0.5" colorSpace="custom" customColorSpace="displayP3"/>
|
||||
<color key="maximumTrackTintColor" white="0.66666666669999997" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</slider>
|
||||
</subviews>
|
||||
@@ -1501,10 +1501,43 @@
|
||||
<segment title="right button"/>
|
||||
</segments>
|
||||
<color key="tintColor" systemColor="systemGray3Color"/>
|
||||
<color key="selectedSegmentTintColor" red="0.23136288839999999" green="0.45776400810000001" blue="0.5149240678" alpha="1" colorSpace="custom" customColorSpace="displayP3"/>
|
||||
<color key="selectedSegmentTintColor" red="0.23087820410000001" green="0.4576539993" blue="0.51765710119999997" alpha="1" colorSpace="custom" customColorSpace="displayP3"/>
|
||||
</segmentedControl>
|
||||
</subviews>
|
||||
</stackView>
|
||||
<stackView opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="LGW-oJ-5Zf" userLabel="slidableStack">
|
||||
<rect key="frame" x="0.0" y="348.5" width="650" height="31"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Slide Activated" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="qNQ-fB-jhY" userLabel="uiLabel">
|
||||
<rect key="frame" x="0.0" y="0.0" width="160" height="31"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="160" id="P7b-Jz-LEK"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<segmentedControl opaque="NO" alpha="0.76999998092651367" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="top" segmentControlStyle="plain" selectedSegmentIndex="0" translatesAutoresizingMaskIntoConstraints="NO" id="cKS-fy-Zpg">
|
||||
<rect key="frame" x="160" y="0.0" width="244" height="32"/>
|
||||
<color key="backgroundColor" white="0.33333333329999998" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<segments>
|
||||
<segment title="yes"/>
|
||||
<segment title="no"/>
|
||||
</segments>
|
||||
<color key="tintColor" systemColor="systemGray3Color"/>
|
||||
<color key="selectedSegmentTintColor" red="0.23087820410000001" green="0.4576539993" blue="0.51765710119999997" alpha="1" colorSpace="custom" customColorSpace="displayP3"/>
|
||||
</segmentedControl>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text=" " textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="dOF-FW-cBU" userLabel="uiLabel">
|
||||
<rect key="frame" x="404" y="0.0" width="246" height="31"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="246" id="hfV-um-PjK"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
</stackView>
|
||||
</subviews>
|
||||
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.5" colorSpace="custom" customColorSpace="displayP3"/>
|
||||
<constraints>
|
||||
@@ -1544,6 +1577,8 @@
|
||||
<outlet property="sensitivityYLabel" destination="NZO-BM-nef" id="baU-O4-Qp7"/>
|
||||
<outlet property="sensitivityYSlider" destination="2Wo-9z-DtK" id="Hw1-JZ-vir"/>
|
||||
<outlet property="sensitivityYStack" destination="CT5-Ap-Gh0" id="qY9-G9-b7r"/>
|
||||
<outlet property="slidableSelector" destination="cKS-fy-Zpg" id="uIq-60-t7E"/>
|
||||
<outlet property="slidableStack" destination="LGW-oJ-5Zf" id="Jn6-Mu-XYp"/>
|
||||
<outlet property="stickIndicatorOffsetLabel" destination="tG7-oX-P9b" id="jBx-ii-091"/>
|
||||
<outlet property="stickIndicatorOffsetSlider" destination="aPX-7o-N3l" id="gLv-c3-3JG"/>
|
||||
<outlet property="stickIndicatorOffsetStack" destination="zfD-bd-GEN" id="oeb-Vk-2mw"/>
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<objects>
|
||||
<viewController id="dgh-JZ-Q7z" customClass="MainFrameViewController" sceneMemberID="viewController">
|
||||
<collectionView key="view" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" dataMode="prototypes" id="Rtu-AT-Alw" customClass="AppCollectionView">
|
||||
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="414" height="756"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="backgroundColor" red="0.3333333432674408" green="0.3333333432674408" blue="0.3333333432674408" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<collectionViewFlowLayout key="collectionViewLayout" minimumLineSpacing="15" minimumInteritemSpacing="15" id="YcZ-cR-3tK">
|
||||
@@ -314,7 +314,7 @@
|
||||
</constraints>
|
||||
</view>
|
||||
<stackView opaque="NO" contentMode="scaleToFill" ambiguous="YES" axis="vertical" spacing="7" translatesAutoresizingMaskIntoConstraints="NO" id="BVp-3O-vZ7" userLabel="widgetPanelStack" customClass="WidgetPanelStackView">
|
||||
<rect key="frame" x="375" y="132" width="550" height="298.5"/>
|
||||
<rect key="frame" x="375" y="132" width="550" height="325.5"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Profile:" textAlignment="center" lineBreakMode="tailTruncation" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="f46-Pt-0Pv">
|
||||
<rect key="frame" x="0.0" y="0.0" width="550" height="28"/>
|
||||
@@ -565,6 +565,42 @@
|
||||
<constraint firstAttribute="height" constant="20" id="Vgj-B6-LEU"/>
|
||||
</constraints>
|
||||
</stackView>
|
||||
<stackView opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="jE7-IB-GTS" userLabel="slidableStack">
|
||||
<rect key="frame" x="0.0" y="305.5" width="550" height="20"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Slide Activated" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="o9I-Gt-YRd" userLabel="uilabel">
|
||||
<rect key="frame" x="0.0" y="0.0" width="160" height="20"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="160" id="W2q-kp-7ce"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<segmentedControl opaque="NO" alpha="0.69999998807907104" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="top" segmentControlStyle="plain" selectedSegmentIndex="0" translatesAutoresizingMaskIntoConstraints="NO" id="ojp-aS-m8w">
|
||||
<rect key="frame" x="160" y="0.0" width="195" height="21"/>
|
||||
<color key="backgroundColor" white="0.33333333329999998" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<segments>
|
||||
<segment title="yes"/>
|
||||
<segment title="no"/>
|
||||
</segments>
|
||||
<color key="tintColor" systemColor="systemGray2Color"/>
|
||||
<color key="selectedSegmentTintColor" red="0.23136288839999999" green="0.45776400810000001" blue="0.5149240678" alpha="1" colorSpace="custom" customColorSpace="displayP3"/>
|
||||
</segmentedControl>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text=" " textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="KZ3-vJ-E8J" userLabel="uilabel">
|
||||
<rect key="frame" x="355" y="0.0" width="195" height="20"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="195" id="BZO-g1-Px9"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="20" id="Qap-bn-YnJ"/>
|
||||
</constraints>
|
||||
</stackView>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.5" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
@@ -597,6 +633,8 @@
|
||||
<outlet property="sensitivityYLabel" destination="R9C-JW-nkF" id="80R-jo-bcA"/>
|
||||
<outlet property="sensitivityYSlider" destination="W7r-eN-vZJ" id="xGy-E1-87k"/>
|
||||
<outlet property="sensitivityYStack" destination="50h-xK-Lq0" id="eOh-7i-9mS"/>
|
||||
<outlet property="slidableSelector" destination="ojp-aS-m8w" id="ACc-Sd-Edq"/>
|
||||
<outlet property="slidableStack" destination="jE7-IB-GTS" id="hKb-gp-eem"/>
|
||||
<outlet property="stickIndicatorOffsetLabel" destination="fcy-zp-LGa" id="lZP-Uv-mMH"/>
|
||||
<outlet property="stickIndicatorOffsetSlider" destination="DCr-vG-gM7" id="aYH-VM-p5l"/>
|
||||
<outlet property="stickIndicatorOffsetStack" destination="Ejp-Jq-phL" id="HNM-4A-VmN"/>
|
||||
@@ -1684,16 +1722,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.63529411764705879" green="0.51764705882352946" 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.18823529411764706" green="0.69019607843137254" blue="0.7803921568627451" 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>
|
||||
|
||||
@@ -387,6 +387,7 @@ static CGRect layoutViewBounds;
|
||||
buttonState.stickIndicatorOffset = widgetView.stickIndicatorOffset;
|
||||
buttonState.widgetShape = widgetView.shape;
|
||||
buttonState.minStickOffset = widgetView.minStickOffset;
|
||||
buttonState.isSlidable = widgetView.isSlidable;
|
||||
|
||||
NSData *buttonStateEncoded = [NSKeyedArchiver archivedDataWithRootObject:buttonState requiringSecureCoding:YES error:nil];
|
||||
[buttonStatesEncoded addObject: buttonStateEncoded];
|
||||
|
||||
@@ -26,6 +26,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@property NSString *alias;
|
||||
@property CGPoint position;
|
||||
@property (nonatomic, assign) BOOL isHidden;
|
||||
@property (nonatomic, assign) BOOL isSlidable;
|
||||
@property (nonatomic, assign) uint8_t buttonType;
|
||||
@property (nonatomic, assign) CGFloat widthFactor; // for OnScreenWidgetView
|
||||
@property (nonatomic, assign) CGFloat heightFactor; // for OnScreenWidgetView
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
[encoder encodeInt:self.mouseButtonAction forKey:@"mouseButtonAction"];
|
||||
[encoder encodeCGPoint:self.position forKey:@"position"];
|
||||
[encoder encodeBool:self.isHidden forKey:@"isHidden"];
|
||||
[encoder encodeBool:self.isSlidable forKey:@"isSlidable"];
|
||||
[encoder encodeFloat:self.widthFactor forKey:@"widthFactor"];
|
||||
[encoder encodeFloat:self.heightFactor forKey:@"heightFactor"];
|
||||
[encoder encodeFloat:self.sensitivityFactorX forKey:@"sensitivityFactorX"];
|
||||
@@ -59,6 +60,7 @@
|
||||
self.mouseButtonAction = [decoder decodeIntForKey:@"mouseButtonAction"];
|
||||
self.position = [decoder decodeCGPointForKey:@"position"];
|
||||
self.isHidden = [decoder decodeBoolForKey:@"isHidden"];
|
||||
self.isSlidable = [decoder decodeBoolForKey:@"isSlidable"];
|
||||
self.widthFactor = [decoder decodeFloatForKey:@"widthFactor"];
|
||||
self.heightFactor = [decoder decodeFloatForKey:@"heightFactor"];
|
||||
self.sensitivityFactorX = [decoder decodeFloatForKey:@"sensitivityFactorX"];
|
||||
|
||||
@@ -45,7 +45,8 @@ import UIKit
|
||||
@objc public var pressed: Bool
|
||||
@objc public var widthFactor: CGFloat = 1.0
|
||||
@objc public var heightFactor: CGFloat = 1.0
|
||||
|
||||
@objc public var isSlidable: Bool = true
|
||||
|
||||
@objc public var deNormalizedWidthFactor: CGFloat = 1.0
|
||||
@objc public var deNormalizedHeightFactor: CGFloat = 1.0
|
||||
|
||||
@@ -135,7 +136,11 @@ import UIKit
|
||||
// border & visual effect
|
||||
private var minimumBorderAlpha: CGFloat = 0.19
|
||||
private var defaultBorderColor: CGColor = UIColor(white: 0.2, alpha: 0.3).cgColor
|
||||
private let moonlightPurple: CGColor = UIColor(red: 0.5, green: 0.5, blue: 1.0, alpha: 0.86).cgColor
|
||||
private let voidlinkPurple: CGColor = UIColor(red: 0.5, green: 0.5, blue: 1.0, alpha: 0.86).cgColor
|
||||
|
||||
//slide buttons
|
||||
private var capturedTouches: NSMutableSet
|
||||
private let noTouch: UITouch = UITouch()
|
||||
|
||||
|
||||
// whole button press down visual effect
|
||||
@@ -227,6 +232,7 @@ import UIKit
|
||||
self.stickIndicatorOffset = 95
|
||||
self.sensitivityFactorX = 1.0
|
||||
self.sensitivityFactorY = 1.0
|
||||
self.capturedTouches = NSMutableSet()
|
||||
super.init(frame: .zero)
|
||||
|
||||
upIndicator = createLrudDirectionLayer()
|
||||
@@ -497,7 +503,7 @@ import UIKit
|
||||
indicatorBorder.fillColor = UIColor.clear.cgColor
|
||||
let path = UIBezierPath(roundedRect: indicatorBorder.bounds, cornerRadius: indicatorBorder.cornerRadius)
|
||||
indicatorBorder.path = path.cgPath
|
||||
indicatorBorder.borderColor = moonlightPurple
|
||||
indicatorBorder.borderColor = voidlinkPurple
|
||||
|
||||
self.layer.superlayer?.addSublayer(indicatorBorder)
|
||||
indicatorBorder.position = CGPointMake(CGRectGetMinX(self.frame)+touchBeganLocation.x, CGRectGetMinY(self.frame)+touchBeganLocation.y)
|
||||
@@ -691,7 +697,7 @@ import UIKit
|
||||
indicatorBorder.fillColor = UIColor.clear.cgColor
|
||||
let path = UIBezierPath(roundedRect: indicatorBorder.bounds, cornerRadius: indicatorBorder.cornerRadius)
|
||||
indicatorBorder.path = path.cgPath
|
||||
indicatorBorder.borderColor = moonlightPurple
|
||||
indicatorBorder.borderColor = voidlinkPurple
|
||||
|
||||
return indicatorBorder
|
||||
}
|
||||
@@ -886,14 +892,14 @@ import UIKit
|
||||
|
||||
|
||||
//==== wholeButtonPress visual effect=============================================
|
||||
private func buttonDownEffect() {
|
||||
// setupBorderLayer()
|
||||
private func handleButtonDown() {
|
||||
if !OnScreenWidgetView.editMode {self.sendComboButtonsDownEvent(comboStrings: self.comboButtonStrings)}
|
||||
CATransaction.begin()
|
||||
CATransaction.setDisableActions(true)
|
||||
// self.layer.borderWidth = 0
|
||||
buttonDownVisualEffectLayer.position = CGPointMake(CGRectGetMidX(self.frame), CGRectGetMidY(self.frame)) // update position every time we press down the button
|
||||
buttonDownVisualEffectLayer.borderWidth = self.buttonDownVisualEffectWidth // this will show the visual effect
|
||||
buttonDownVisualEffectLayer.borderColor = moonlightPurple
|
||||
buttonDownVisualEffectLayer.borderColor = voidlinkPurple
|
||||
if vibrationOn {
|
||||
vibrationGenerator.prepare()
|
||||
vibrationGenerator.impactOccurred()
|
||||
@@ -902,7 +908,8 @@ import UIKit
|
||||
CATransaction.commit()
|
||||
}
|
||||
|
||||
private func buttonUpVisualEffect() {
|
||||
private func handlebuttonUp() {
|
||||
if !OnScreenWidgetView.editMode {self.sendComboButtonsUpEvent(comboStrings: self.comboButtonStrings)}
|
||||
CATransaction.begin()
|
||||
CATransaction.setDisableActions(true)
|
||||
// self.layer.borderWidth = 1
|
||||
@@ -1041,11 +1048,11 @@ import UIKit
|
||||
//==============================================================================
|
||||
// Touch event handling
|
||||
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
|
||||
|
||||
self.touchBegan = true
|
||||
self.firstTouchMoved = false
|
||||
super.touchesBegan(touches, with: event)
|
||||
self.isMultipleTouchEnabled = self.touchPadString == "MOUSEPAD" // only enable multi-touch in mousePad mode
|
||||
// self.isMultipleTouchEnabled = self.touchPadString == "MOUSEPAD" // only enable multi-touch in mousePad mode
|
||||
self.isMultipleTouchEnabled = true
|
||||
|
||||
if !OnScreenWidgetView.editMode && self.touchPadString == "TRACKBALL" {
|
||||
stopTrackballMomentum()
|
||||
@@ -1143,8 +1150,9 @@ import UIKit
|
||||
|
||||
// this will also deal with button events
|
||||
if self.widgetType == WidgetTypeEnum.button && !self.comboButtonStrings.isEmpty {
|
||||
self.buttonDownEffect()
|
||||
self.sendComboButtonsDownEvent(comboStrings: self.comboButtonStrings)
|
||||
self.handleButtonDown()
|
||||
self.capturedTouches.union(touches)
|
||||
//self.handleButtonSliding(touches: touches)
|
||||
}
|
||||
|
||||
// legacy keyboard button combo connected by "+"
|
||||
@@ -1152,13 +1160,13 @@ import UIKit
|
||||
let keyboardCmdStrings = CommandManager.shared.extractKeyStringsFromComboCommand(from: self.cmdString)!
|
||||
CommandManager.shared.sendKeyComboCommand(keyboardCmdStrings: keyboardCmdStrings) // send multi-key command
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.03) { // reset shadow color immediately 50ms later
|
||||
self.buttonUpVisualEffect()
|
||||
self.handlebuttonUp()
|
||||
}
|
||||
}
|
||||
}
|
||||
// here is in edit mode:
|
||||
else{
|
||||
self.buttonDownEffect()
|
||||
self.handleButtonDown()
|
||||
NotificationCenter.default.post(name: Notification.Name("OnScreenWidgetViewSelected"),object: self) // inform layout tool controller to fetch button size factors. self will be passed as the object of the notification
|
||||
}
|
||||
}
|
||||
@@ -1184,16 +1192,59 @@ import UIKit
|
||||
}
|
||||
}
|
||||
|
||||
private func handleButtonSlidingUp(touches: Set<UITouch>) {
|
||||
for touch in touches {
|
||||
for subview in self.superview?.subviews ?? [] {
|
||||
if let widget = subview as? OnScreenWidgetView{
|
||||
if !widget.capturedTouches.contains(touch) || !widget.isSlidable {continue}
|
||||
widget.handlebuttonUp()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func handleButtonSliding(touches: Set<UITouch>) {
|
||||
for touch in touches {
|
||||
let locationInSuperView = touch.location(in: self.superview)
|
||||
for subview in self.superview?.subviews ?? [] {
|
||||
if let widget = subview as? OnScreenWidgetView{
|
||||
if widget.widgetType != WidgetTypeEnum.button {continue}
|
||||
let pointInSubview = widget.convert(locationInSuperView, from: self.superview)
|
||||
if widget.bounds.contains(pointInSubview){
|
||||
if widget.capturedTouches.contains(touch) || !widget.isSlidable {continue}
|
||||
widget.capturedTouches.add(touch)
|
||||
widget.handleButtonDown()
|
||||
print("UIButton: \(widget.buttonLabel) in, \(widget.touchPadString), \(CACurrentMediaTime())")
|
||||
}
|
||||
else{
|
||||
if !widget.capturedTouches.contains(touch) || !widget.isSlidable {continue}
|
||||
print("UIButton: \(widget.buttonLabel) out test, \(widget.touchPadString), \(CACurrentMediaTime())")
|
||||
widget.capturedTouches.remove(touch)
|
||||
widget.handlebuttonUp()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override func touchesMoved(_ touches: Set<UITouch>, with event: UIEvent?) {
|
||||
super.touchesMoved(touches, with: event)
|
||||
if !OnScreenWidgetView.editMode {
|
||||
handleTouchPadMoveEvent(touches, with: event)
|
||||
|
||||
if !self.touchPadString.isEmpty{
|
||||
handleTouchPadMoveEvent(touches, with: event)
|
||||
}
|
||||
|
||||
if !self.buttonString.isEmpty{
|
||||
if self.isSlidable {self.handleButtonSliding(touches: touches)}
|
||||
}
|
||||
|
||||
if CommandManager.specialOverlayButtonCmds.contains(self.cmdString){
|
||||
if let touch = touches.first {
|
||||
NSLog("touchTapTimeStamp %f", self.touchTapTimeStamp)
|
||||
if CACurrentMediaTime() - self.touchTapTimeStamp > 0.3 { // temporarily relocate special buttons
|
||||
self.moveByTouch(touch: touch)
|
||||
self.buttonUpVisualEffect()
|
||||
self.handlebuttonUp()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1365,7 +1416,8 @@ import UIKit
|
||||
self.lrudIndicatorBall.removeFromSuperlayer()
|
||||
|
||||
if !OnScreenWidgetView.editMode && !self.cmdString.contains("+") && !self.comboButtonStrings.isEmpty { // if the command(keystring contains "+", it's a legacy multi-key command
|
||||
self.sendComboButtonsUpEvent(comboStrings: self.comboButtonStrings)
|
||||
self.handleButtonSlidingUp(touches: touches)
|
||||
self.capturedTouches.minus(touches)
|
||||
}
|
||||
|
||||
if !OnScreenWidgetView.editMode && CommandManager.specialOverlayButtonCmds.contains(self.cmdString){
|
||||
@@ -1417,7 +1469,7 @@ import UIKit
|
||||
}
|
||||
}
|
||||
|
||||
self.buttonUpVisualEffect()
|
||||
self.handlebuttonUp()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -232,12 +232,12 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5;
|
||||
}
|
||||
|
||||
- (void)keyboardWillShow:(NSNotification *)notification{
|
||||
NSLog(@"keyboard will show markmark %f", CACurrentMediaTime());
|
||||
// NSLog(@"keyboard will show markmark %f", CACurrentMediaTime());
|
||||
if(settings.liftStreamViewForKeyboard && !isInputingText){
|
||||
NSDictionary *userInfo = notification.userInfo;
|
||||
// Get the keyboard size from the notification
|
||||
CGRect keyboardFrame = [userInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue];
|
||||
NSLog(@"keyboard will show markmark, lowest height %f", keyboardToggleRecognizer.lowestTouchPointHeight);
|
||||
// NSLog(@"keyboard will show markmark, lowest height %f", keyboardToggleRecognizer.lowestTouchPointHeight);
|
||||
if(keyboardFrame.size.height < CGRectGetHeight([[UIScreen mainScreen] bounds]) * 0.25) return; // return in case of abnormal keyboard height
|
||||
HeightViewLiftedTo = keyboardFrame.size.height - keyboardToggleRecognizer.lowestTouchPointHeight + CGRectGetHeight([[UIScreen mainScreen] bounds]) * 0.1; // 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.
|
||||
@@ -454,6 +454,7 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5;
|
||||
widgetView.trackballDecelerationRate = buttonState.decelerationRate;
|
||||
widgetView.stickIndicatorOffset = buttonState.stickIndicatorOffset;
|
||||
widgetView.minStickOffset = buttonState.minStickOffset;
|
||||
widgetView.isSlidable = buttonState.isSlidable;
|
||||
// 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.
|
||||
buttonState.position = [self denormalizeWidgetPosition:buttonState.position];
|
||||
|
||||
@@ -93,6 +93,9 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@property (strong, nonatomic) IBOutlet UIStackView *mouseDownButtonStack;
|
||||
@property (strong, nonatomic) IBOutlet UISegmentedControl *mouseButtonDownSelector;
|
||||
|
||||
@property (strong, nonatomic) IBOutlet UIStackView *slidableStack;
|
||||
@property (strong, nonatomic) IBOutlet UISegmentedControl *slidableSelector;
|
||||
|
||||
|
||||
|
||||
@property (weak, nonatomic) IBOutlet UIStackView *widgetPanelStack;
|
||||
|
||||
+17
-1
@@ -123,6 +123,7 @@
|
||||
widgetView.trackballDecelerationRate = buttonState.decelerationRate;
|
||||
widgetView.stickIndicatorOffset = buttonState.stickIndicatorOffset;
|
||||
widgetView.minStickOffset = buttonState.minStickOffset;
|
||||
widgetView.isSlidable = buttonState.isSlidable;
|
||||
// Add the widgetView to the view controller's view
|
||||
[self.view insertSubview:widgetView belowSubview:self.widgetPanelStack];
|
||||
buttonState.position = [self denormalizeWidgetPosition:buttonState.position];
|
||||
@@ -634,6 +635,7 @@
|
||||
newWidget.minStickOffset = [widgetInitParams[@"minStickOffsetString"] floatValue];
|
||||
[newWidget setVibrationWithStyle:widget.vibrationStyle];
|
||||
newWidget.mouseButtonAction = widget.mouseButtonAction;
|
||||
newWidget.isSlidable = widget.isSlidable;
|
||||
[self.view insertSubview:newWidget belowSubview:self.widgetPanelStack];
|
||||
|
||||
if(createNew) [newWidget setLocationWithPosition:CGPointMake(90, 130)];
|
||||
@@ -750,6 +752,9 @@
|
||||
[self.widgetAlphaSlider setValue: self->selectedWidgetView.backgroundAlpha];
|
||||
[self.widgetBorderWidthSlider setValue:self->selectedWidgetView.borderWidth];
|
||||
|
||||
self.slidableStack.hidden = selectedWidgetView.widgetType != WidgetTypeEnumButton;
|
||||
[self.slidableSelector setSelectedSegmentIndex:selectedWidgetView.isSlidable ? 0 : 1];
|
||||
|
||||
bool showSensitivityFactorStack = selectedWidgetView.hasSensitivityTweak;
|
||||
bool showStickIndicatorOffsetStack = selectedWidgetView.hasStickIndicator;
|
||||
|
||||
@@ -901,6 +906,12 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (void)slidableChanged:(UISegmentedControl* )sender{
|
||||
if(self->selectedWidgetView != nil && self->widgetViewSelected){
|
||||
selectedWidgetView.isSlidable = _slidableSelector.selectedSegmentIndex == 0;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)vibrationStyleChanged:(UISegmentedControl* )sender{
|
||||
bool vibraiontOn;
|
||||
if (@available(iOS 13.0, *)) {
|
||||
@@ -1046,13 +1057,18 @@
|
||||
self.stickIndicatorOffsetLabel.text = [LocalizationHelper localizedStringForKey:@"Indicator Offset"];
|
||||
self.stickIndicatorOffsetStack.hidden = YES;
|
||||
|
||||
[self.mouseButtonDownSelector addTarget:self action:@selector(mouseDownButtonChanged:) forControlEvents:(UIControlEventValueChanged)];
|
||||
NSDictionary *whiteFontAttributes = @{
|
||||
NSForegroundColorAttributeName: [UIColor whiteColor]
|
||||
};
|
||||
|
||||
[self.mouseButtonDownSelector addTarget:self action:@selector(mouseDownButtonChanged:) forControlEvents:(UIControlEventValueChanged)];
|
||||
[self.mouseButtonDownSelector setTitleTextAttributes:whiteFontAttributes forState:UIControlStateNormal];
|
||||
self.mouseDownButtonStack.hidden = YES;
|
||||
|
||||
[self.slidableSelector addTarget:self action:@selector(slidableChanged:) forControlEvents:(UIControlEventValueChanged)];
|
||||
[self.slidableSelector setTitleTextAttributes:whiteFontAttributes forState:UIControlStateNormal];
|
||||
self.slidableStack.hidden = YES;
|
||||
|
||||
|
||||
if([self isIPhone]){
|
||||
[self.vibrationStyleSelector addTarget:self action:@selector(vibrationStyleChanged:) forControlEvents:(UIControlEventValueChanged)];
|
||||
|
||||
@@ -1918,7 +1918,7 @@ static NSMutableSet* hostList;
|
||||
}
|
||||
|
||||
- (void)updateHosts {
|
||||
Log(LOG_I, @"Updating hosts %f", CACurrentMediaTime());
|
||||
// Log(LOG_I, @"Updating hosts %f", CACurrentMediaTime());
|
||||
@synchronized (hostList) {
|
||||
// Sort the host list in alphabetical order
|
||||
NSArray* sortedHostList = [[hostList allObjects] sortedArrayUsingSelector:@selector(compareName:)];
|
||||
|
||||
@@ -1051,6 +1051,66 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"cKS-fy-Zpg.segmentTitles[0]" : {
|
||||
"comment" : "Class = \"UISegmentedControl\"; cKS-fy-Zpg.segmentTitles[0] = \"yes\"; ObjectID = \"cKS-fy-Zpg\";",
|
||||
"extractionState" : "extracted_with_value",
|
||||
"localizations" : {
|
||||
"en" : {
|
||||
"stringUnit" : {
|
||||
"state" : "new",
|
||||
"value" : "yes"
|
||||
}
|
||||
},
|
||||
"zh-Hans" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "开启"
|
||||
}
|
||||
},
|
||||
"zh-Hant" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "開啟"
|
||||
}
|
||||
},
|
||||
"zh-HK" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "開啟"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"cKS-fy-Zpg.segmentTitles[1]" : {
|
||||
"comment" : "Class = \"UISegmentedControl\"; cKS-fy-Zpg.segmentTitles[1] = \"no\"; ObjectID = \"cKS-fy-Zpg\";",
|
||||
"extractionState" : "extracted_with_value",
|
||||
"localizations" : {
|
||||
"en" : {
|
||||
"stringUnit" : {
|
||||
"state" : "new",
|
||||
"value" : "no"
|
||||
}
|
||||
},
|
||||
"zh-Hans" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "关闭"
|
||||
}
|
||||
},
|
||||
"zh-Hant" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "關閉"
|
||||
}
|
||||
},
|
||||
"zh-HK" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "關閉"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"CpY-Sb-BDc.title" : {
|
||||
"comment" : "Class = \"UIBarButtonItem\"; title = \"Import\"; ObjectID = \"CpY-Sb-BDc\";",
|
||||
"extractionState" : "extracted_with_value",
|
||||
@@ -1141,6 +1201,18 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"dOF-FW-cBU.text" : {
|
||||
"comment" : "Class = \"UILabel\"; text = \" \"; ObjectID = \"dOF-FW-cBU\";",
|
||||
"extractionState" : "extracted_with_value",
|
||||
"localizations" : {
|
||||
"en" : {
|
||||
"stringUnit" : {
|
||||
"state" : "new",
|
||||
"value" : " "
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"dpd-Bw-aHE.segmentTitles[0]" : {
|
||||
"comment" : "Class = \"UISegmentedControl\"; dpd-Bw-aHE.segmentTitles[0] = \"No\"; ObjectID = \"dpd-Bw-aHE\";",
|
||||
"extractionState" : "stale",
|
||||
@@ -2737,6 +2809,36 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"qNQ-fB-jhY.text" : {
|
||||
"comment" : "Class = \"UILabel\"; text = \"Slide Activated\"; ObjectID = \"qNQ-fB-jhY\";",
|
||||
"extractionState" : "extracted_with_value",
|
||||
"localizations" : {
|
||||
"en" : {
|
||||
"stringUnit" : {
|
||||
"state" : "new",
|
||||
"value" : "Slide Activated"
|
||||
}
|
||||
},
|
||||
"zh-Hans" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "滑动触发"
|
||||
}
|
||||
},
|
||||
"zh-Hant" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "滑動觸發"
|
||||
}
|
||||
},
|
||||
"zh-HK" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "滑動觸發"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"Qs9-iS-YoW.text" : {
|
||||
"comment" : "Class = \"UILabel\"; text = \"Divider Position\"; ObjectID = \"Qs9-iS-YoW\";",
|
||||
"extractionState" : "extracted_with_value",
|
||||
|
||||
@@ -1783,6 +1783,18 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"KZ3-vJ-E8J.text" : {
|
||||
"comment" : "Class = \"UILabel\"; text = \" \"; ObjectID = \"KZ3-vJ-E8J\";",
|
||||
"extractionState" : "extracted_with_value",
|
||||
"localizations" : {
|
||||
"en" : {
|
||||
"stringUnit" : {
|
||||
"state" : "new",
|
||||
"value" : " "
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"lwy-Nu-hQj.text" : {
|
||||
"comment" : "Class = \"UILabel\"; text = \"External Display Mode\"; ObjectID = \"lwy-Nu-hQj\";",
|
||||
"extractionState" : "extracted_with_value",
|
||||
@@ -1975,6 +1987,36 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"o9I-Gt-YRd.text" : {
|
||||
"comment" : "Class = \"UILabel\"; text = \"Slide Activated\"; ObjectID = \"o9I-Gt-YRd\";",
|
||||
"extractionState" : "extracted_with_value",
|
||||
"localizations" : {
|
||||
"en" : {
|
||||
"stringUnit" : {
|
||||
"state" : "new",
|
||||
"value" : "Slide Activated"
|
||||
}
|
||||
},
|
||||
"zh-Hans" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "滑动触发"
|
||||
}
|
||||
},
|
||||
"zh-Hant" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "滑動觸發"
|
||||
}
|
||||
},
|
||||
"zh-HK" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "滑動觸發"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"oBs-zz-ZQv.segmentTitles[0]" : {
|
||||
"comment" : "Class = \"UISegmentedControl\"; oBs-zz-ZQv.segmentTitles[0] = \"Slide From Left Edge\"; ObjectID = \"oBs-zz-ZQv\";",
|
||||
"extractionState" : "extracted_with_value",
|
||||
@@ -2035,6 +2077,66 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"ojp-aS-m8w.segmentTitles[0]" : {
|
||||
"comment" : "Class = \"UISegmentedControl\"; ojp-aS-m8w.segmentTitles[0] = \"yes\"; ObjectID = \"ojp-aS-m8w\";",
|
||||
"extractionState" : "extracted_with_value",
|
||||
"localizations" : {
|
||||
"en" : {
|
||||
"stringUnit" : {
|
||||
"state" : "new",
|
||||
"value" : "yes"
|
||||
}
|
||||
},
|
||||
"zh-Hans" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "开启"
|
||||
}
|
||||
},
|
||||
"zh-Hant" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "開啟"
|
||||
}
|
||||
},
|
||||
"zh-HK" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "開啟"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"ojp-aS-m8w.segmentTitles[1]" : {
|
||||
"comment" : "Class = \"UISegmentedControl\"; ojp-aS-m8w.segmentTitles[1] = \"no\"; ObjectID = \"ojp-aS-m8w\";",
|
||||
"extractionState" : "extracted_with_value",
|
||||
"localizations" : {
|
||||
"en" : {
|
||||
"stringUnit" : {
|
||||
"state" : "new",
|
||||
"value" : "no"
|
||||
}
|
||||
},
|
||||
"zh-Hans" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "关闭"
|
||||
}
|
||||
},
|
||||
"zh-Hant" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "關閉"
|
||||
}
|
||||
},
|
||||
"zh-HK" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "關閉"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"ozU-7C-qKE.text" : {
|
||||
"comment" : "Class = \"UILabel\"; text = \"Button Down\"; ObjectID = \"ozU-7C-qKE\";",
|
||||
"extractionState" : "extracted_with_value",
|
||||
|
||||
Reference in New Issue
Block a user