- feat: tap to toggle on-screen button triggering
- fixed: special overlay button relocation
This commit is contained in:
@@ -1835,10 +1835,10 @@
|
||||
</segmentedControl>
|
||||
</subviews>
|
||||
</stackView>
|
||||
<stackView opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="LGW-oJ-5Zf" userLabel="slidableStack">
|
||||
<stackView opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="LGW-oJ-5Zf" userLabel="triggerModeStack">
|
||||
<rect key="frame" x="0.0" y="518" width="650" height="31"/>
|
||||
<subviews>
|
||||
<label verifyAmbiguity="off" 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">
|
||||
<label verifyAmbiguity="off" opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Trigger mode" 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="130" height="31"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="130" id="P7b-Jz-LEK"/>
|
||||
@@ -1847,21 +1847,22 @@
|
||||
<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="130" y="0.0" width="335" height="32"/>
|
||||
<segmentedControl opaque="NO" alpha="0.76999998092651367" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="top" apportionsSegmentWidthsByContent="YES" segmentControlStyle="plain" selectedSegmentIndex="0" translatesAutoresizingMaskIntoConstraints="NO" id="cKS-fy-Zpg">
|
||||
<rect key="frame" x="130" y="0.0" width="385" height="32"/>
|
||||
<color key="backgroundColor" white="0.33333333329999998" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<segments>
|
||||
<segment title="slide to release"/>
|
||||
<segment title="slide to toggle"/>
|
||||
<segment title="slide & hold"/>
|
||||
<segment title="disabled"/>
|
||||
<segment title="regular"/>
|
||||
<segment title="tap to toggle"/>
|
||||
</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 verifyAmbiguity="off" 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="465" y="0.0" width="185" height="31"/>
|
||||
<rect key="frame" x="515" y="0.0" width="135" height="31"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="185" id="hfV-um-PjK"/>
|
||||
<constraint firstAttribute="width" constant="135" id="hfV-um-PjK"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
@@ -1910,8 +1911,6 @@
|
||||
<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"/>
|
||||
@@ -1921,6 +1920,8 @@
|
||||
<outlet property="toolbarStackView" destination="YLK-IE-ajS" id="j4o-Kp-7Z8"/>
|
||||
<outlet property="toolbarTopConstraintiPad" destination="Ppb-J1-lXg" id="laN-Zh-lHm"/>
|
||||
<outlet property="trashCanButton" destination="qJs-n8-eV7" id="ubK-qm-Cox"/>
|
||||
<outlet property="triggerModeSelector" destination="cKS-fy-Zpg" id="uIq-60-t7E"/>
|
||||
<outlet property="triggerModeStack" destination="LGW-oJ-5Zf" id="Jn6-Mu-XYp"/>
|
||||
<outlet property="undoButton" destination="F7X-l4-cl3" id="vAI-XQ-hZw"/>
|
||||
<outlet property="widgetAlphaLabel" destination="Pwa-YK-6Q2" id="IPF-Es-yTr"/>
|
||||
<outlet property="widgetAlphaSlider" destination="ii1-Iq-jI4" id="Rev-dn-n3F"/>
|
||||
|
||||
@@ -608,7 +608,7 @@
|
||||
<stackView opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="jE7-IB-GTS" userLabel="slidableStack">
|
||||
<rect key="frame" x="0.0" y="577" 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">
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Trigger Mode" 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"/>
|
||||
@@ -617,13 +617,14 @@
|
||||
<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">
|
||||
<segmentedControl opaque="NO" alpha="0.69999998807907104" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="top" apportionsSegmentWidthsByContent="YES" segmentControlStyle="plain" selectedSegmentIndex="0" translatesAutoresizingMaskIntoConstraints="NO" id="ojp-aS-m8w">
|
||||
<rect key="frame" x="160" y="0.0" width="350" height="21"/>
|
||||
<color key="backgroundColor" white="0.33333333329999998" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<segments>
|
||||
<segment title="slide to release"/>
|
||||
<segment title="slide to toggle"/>
|
||||
<segment title="slide & hold"/>
|
||||
<segment title="disabled"/>
|
||||
<segment title="regular"/>
|
||||
<segment title="tap to toggle"/>
|
||||
</segments>
|
||||
<color key="tintColor" systemColor="systemGray2Color"/>
|
||||
<color key="selectedSegmentTintColor" red="0.23136288839999999" green="0.45776400810000001" blue="0.5149240678" alpha="1" colorSpace="custom" customColorSpace="displayP3"/>
|
||||
@@ -676,8 +677,6 @@
|
||||
<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"/>
|
||||
@@ -687,6 +686,8 @@
|
||||
<outlet property="toolbarStackView" destination="4he-pe-kYB" id="eVm-jM-dcv"/>
|
||||
<outlet property="toolbarTopConstraintiPhone" destination="wNr-7F-S0i" id="iXe-d3-R7i"/>
|
||||
<outlet property="trashCanButton" destination="dhG-Fo-0GK" id="dv6-TN-2Bj"/>
|
||||
<outlet property="triggerModeSelector" destination="ojp-aS-m8w" id="ACc-Sd-Edq"/>
|
||||
<outlet property="triggerModeStack" destination="jE7-IB-GTS" id="hKb-gp-eem"/>
|
||||
<outlet property="undoButton" destination="Pdg-l4-BvF" id="emD-GI-v2v"/>
|
||||
<outlet property="vibrationStyleSelector" destination="QRV-je-HEZ" id="cEF-HG-B4h"/>
|
||||
<outlet property="vibrationStyleStack" destination="gsG-6n-BAb" id="etn-BF-xqj"/>
|
||||
@@ -2059,19 +2060,19 @@
|
||||
<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.47843137250000001" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<color red="0.0" green="0.47843137254901963" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
</systemColor>
|
||||
<systemColor name="secondarySystemGroupedBackgroundColor">
|
||||
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</systemColor>
|
||||
<systemColor name="systemBrownColor">
|
||||
<color red="0.63529411759999999" green="0.51764705879999995" blue="0.36862745099999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<color red="0.63529411764705879" green="0.51764705882352946" blue="0.36862745098039218" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
</systemColor>
|
||||
<systemColor name="systemGray2Color">
|
||||
<color red="0.68235294120000001" green="0.68235294120000001" blue="0.69803921570000005" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<color red="0.68235294117647061" green="0.68235294117647061" blue="0.69803921568627447" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
</systemColor>
|
||||
<systemColor name="systemTealColor">
|
||||
<color red="0.18823529410000001" green="0.69019607839999997" blue="0.78039215689999997" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<color red="0.18823529411764706" green="0.69019607843137254" blue="0.7803921568627451" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
</systemColor>
|
||||
</resources>
|
||||
</document>
|
||||
|
||||
@@ -119,7 +119,7 @@ import UIKit
|
||||
@objc public static let directionPads: [String] = ["DPAD", "WASDPAD", "ARROWPAD"]
|
||||
@objc public static let stickTouchPads: [String] = ["LSVPAD", "RSVPAD", "LSPAD", "RSPAD"]
|
||||
@objc public static let nonVectorStickPads: [String] = ["LSPAD", "RSPAD"]
|
||||
@objc public static let specialOverlayButtonCmds: [String] = ["SETTINGS"]
|
||||
@objc public static let specialOverlayButtonCmds: [String] = ["SETTINGS","GYRO"]
|
||||
|
||||
// @objc public static let specialGameWidgets: [String] = ["YSRSV", "YSLT", "YSRT", "YSRB", "YSB", "YSRT2", "YSRB2", "YSB2", "YSEM", "YSML", "YSMR", "YSWASD"]
|
||||
|
||||
@@ -384,7 +384,7 @@ import UIKit
|
||||
let defaults = UserDefaults.standard
|
||||
//if true { // save default entries if the data is empty.
|
||||
if defaults.data(forKey: "savedCommands") == nil { // save default entries if the data is empty.
|
||||
var defaultCommands: [RemoteCommand] = [
|
||||
let defaultCommands: [RemoteCommand] = [
|
||||
RemoteCommand(cmdString: "WIN", alias: "WIN"),
|
||||
RemoteCommand(cmdString: "F11", alias: "F11"),
|
||||
RemoteCommand(cmdString: "ESC", alias: "ESC"),
|
||||
@@ -463,6 +463,7 @@ import UIKit
|
||||
let combinedStrings = [CommandManager.keyboardButtonMappings.keys.map { $0 as String },
|
||||
CommandManager.oscButtonMappings.keys.map { $0 as String },
|
||||
CommandManager.mouseButtonMappings.keys.map { $0 as String },
|
||||
CommandManager.specialOverlayButtonCmds.map { $0 as String },
|
||||
CommandManager.touchPadCmds.map { $0 as String }
|
||||
]
|
||||
.lazy
|
||||
@@ -603,6 +604,4 @@ import UIKit
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -390,7 +390,7 @@ static CGRect layoutViewBounds;
|
||||
buttonState.stickIndicatorOffset = widgetView.stickIndicatorOffset;
|
||||
buttonState.widgetShape = widgetView.shape;
|
||||
buttonState.minStickOffset = widgetView.minStickOffset;
|
||||
buttonState.slideMode = widgetView.slideMode;
|
||||
buttonState.buttonTriggerMode = widgetView.buttonTriggerMode;
|
||||
|
||||
NSData *buttonStateEncoded = [NSKeyedArchiver archivedDataWithRootObject:buttonState requiringSecureCoding:YES error:nil];
|
||||
[buttonStatesEncoded addObject: buttonStateEncoded];
|
||||
|
||||
@@ -26,7 +26,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@property NSString *alias;
|
||||
@property CGPoint position;
|
||||
@property (nonatomic, assign) BOOL isHidden;
|
||||
@property (nonatomic, assign) uint8_t slideMode;
|
||||
@property (nonatomic, assign) uint8_t buttonTriggerMode;
|
||||
@property (nonatomic, assign) uint8_t buttonType;
|
||||
@property (nonatomic, assign) uint8_t sizeReference;
|
||||
@property (nonatomic, assign) CGFloat widthFactor; // for OnScreenWidgetView
|
||||
@@ -66,10 +66,11 @@ typedef NS_ENUM(NSInteger, MouseButtonAction) {
|
||||
noClick
|
||||
};
|
||||
|
||||
typedef NS_ENUM(NSInteger, ButtonSlideMode) {
|
||||
toggle,
|
||||
typedef NS_ENUM(NSInteger, ButtonTriggerMode) {
|
||||
slideToToggle,
|
||||
slideAndHold,
|
||||
disabled
|
||||
regular,
|
||||
tapToToggle
|
||||
};
|
||||
|
||||
- (id) initWithButtonName:(NSString*)name buttonType:(uint8_t)buttonType andPosition:(CGPoint)position;
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
[encoder encodeInt:self.sizeReference forKey:@"sizeReference"];
|
||||
[encoder encodeInt:self.vibrationStyle forKey:@"vibrationStyle"];
|
||||
[encoder encodeInt:self.mouseButtonAction forKey:@"mouseButtonAction"];
|
||||
[encoder encodeInt:self.slideMode forKey:@"slideMode"];
|
||||
[encoder encodeInt:self.buttonTriggerMode forKey:@"slideMode"]; // triggerMode: previously slideMode
|
||||
[encoder encodeInt:self.autoTapInterval forKey:@"autoTapInterval"];
|
||||
[encoder encodeCGPoint:self.position forKey:@"position"];
|
||||
[encoder encodeBool:self.isHidden forKey:@"isHidden"];
|
||||
@@ -61,7 +61,7 @@
|
||||
self.sizeReference = [decoder containsValueForKey:@"sizeReference"] ? [decoder decodeIntForKey:@"sizeReference"] : longSide;
|
||||
self.vibrationStyle = [decoder decodeIntForKey:@"vibrationStyle"];
|
||||
self.mouseButtonAction = [decoder decodeIntForKey:@"mouseButtonAction"];
|
||||
self.slideMode = [decoder containsValueForKey:@"slideMode"] ? [decoder decodeIntForKey:@"slideMode"] : 0;
|
||||
self.buttonTriggerMode = [decoder containsValueForKey:@"slideMode"] ? [decoder decodeIntForKey:@"slideMode"] : 0;
|
||||
self.autoTapInterval = [decoder containsValueForKey:@"autoTapInterval"] ? [decoder decodeIntForKey:@"autoTapInterval"] : 45;
|
||||
self.position = [decoder decodeCGPointForKey:@"position"];
|
||||
self.isHidden = [decoder decodeBoolForKey:@"isHidden"];
|
||||
|
||||
@@ -46,7 +46,9 @@ import UIKit
|
||||
@objc public var pressed: Bool
|
||||
@objc public var widthFactor: CGFloat = 1.0
|
||||
@objc public var heightFactor: CGFloat = 1.0
|
||||
@objc public var slideMode: Int = 0
|
||||
|
||||
@objc public var buttonTriggerMode: Int = 0
|
||||
@objc private var tapToToggleFlag: Bool = true
|
||||
|
||||
@objc public var sizeReference: Int = WidgetSizeReference.longSide.rawValue
|
||||
@objc public var deNormalizedWidthFactor: CGFloat = 1.0
|
||||
@@ -276,7 +278,10 @@ import UIKit
|
||||
if self.widgetType == WidgetTypeEnum.button {
|
||||
if !self.touchPadString.isEmpty {
|
||||
self.mouseButtonAction = MouseButtonAction.noClick
|
||||
self.slideMode = ButtonSlideMode.disabled.rawValue
|
||||
self.buttonTriggerMode = ButtonTriggerMode.regular.rawValue
|
||||
}
|
||||
if !Set(CommandManager.specialOverlayButtonCmds).isDisjoint(with: Set(self.comboButtonStrings)) {
|
||||
self.buttonTriggerMode = ButtonTriggerMode.regular.rawValue
|
||||
}
|
||||
}
|
||||
|
||||
@@ -529,7 +534,7 @@ import UIKit
|
||||
}
|
||||
}
|
||||
|
||||
if CommandManager.specialOverlayButtonCmds.contains(self.cmdString){
|
||||
if !Set(CommandManager.specialOverlayButtonCmds).isDisjoint(with: Set(self.comboButtonStrings)){
|
||||
self.layer.borderWidth = 0
|
||||
}
|
||||
|
||||
@@ -1239,7 +1244,7 @@ import UIKit
|
||||
quickDoubleTapDetected = touchTapTimeInterval < QUICK_TAP_TIME_INTERVAL
|
||||
|
||||
let touch = touches.first
|
||||
if OnScreenWidgetView.editMode {self.touchBeganLocation = touch!.location(in: superview)}
|
||||
if OnScreenWidgetView.editMode || !Set(CommandManager.specialOverlayButtonCmds).isDisjoint(with: Set(self.comboButtonStrings)) {self.touchBeganLocation = touch!.location(in: superview)}
|
||||
else {self.touchBeganLocation = touch!.location(in: self)}
|
||||
self.latestTouchLocation = touchBeganLocation
|
||||
}
|
||||
@@ -1312,11 +1317,17 @@ import UIKit
|
||||
|
||||
// this will also deal with button events
|
||||
if self.widgetType == WidgetTypeEnum.button && !self.comboButtonStrings.isEmpty {
|
||||
self.handleTapDownOrSlidein()
|
||||
setLock.lock()
|
||||
self.capturedTouches.union(touches)
|
||||
setLock.unlock()
|
||||
//self.handleButtonSliding(touches: touches)
|
||||
if self.buttonTriggerMode != ButtonTriggerMode.tapToToggle.rawValue {
|
||||
self.handleTapDownOrSlidein()
|
||||
setLock.lock()
|
||||
self.capturedTouches.union(touches)
|
||||
setLock.unlock()
|
||||
}
|
||||
else{
|
||||
if(self.tapToToggleFlag) {self.handleTapDownOrSlidein()}
|
||||
else {self.handleFingerUpOrSlideout()}
|
||||
self.tapToToggleFlag = !self.tapToToggleFlag
|
||||
}
|
||||
}
|
||||
|
||||
// legacy keyboard button combo connected by "+"
|
||||
@@ -1337,7 +1348,7 @@ import UIKit
|
||||
|
||||
private func moveByTouch(touch: UITouch){
|
||||
let currentLocation: CGPoint
|
||||
if OnScreenWidgetView.editMode {currentLocation = touch.location(in: superview)}
|
||||
if OnScreenWidgetView.editMode || !Set(CommandManager.specialOverlayButtonCmds).isDisjoint(with: Set(self.comboButtonStrings)) {currentLocation = touch.location(in: superview)}
|
||||
else {currentLocation = touch.location(in: self)}
|
||||
|
||||
if !firstTouchMoved {
|
||||
@@ -1404,7 +1415,7 @@ import UIKit
|
||||
setLock.lock()
|
||||
let captured = widget.capturedTouches.contains(touch)
|
||||
setLock.unlock()
|
||||
if !captured || widget.slideMode == ButtonSlideMode.disabled.rawValue {continue}
|
||||
if !captured || widget.buttonTriggerMode == ButtonTriggerMode.regular.rawValue {continue}
|
||||
widget.handleFingerUpOrSlideout()
|
||||
setLock.lock()
|
||||
widget.capturedTouches.remove(touch)
|
||||
@@ -1420,12 +1431,14 @@ import UIKit
|
||||
for subview in self.superview?.subviews ?? [] {
|
||||
if let widget = subview as? OnScreenWidgetView{
|
||||
if widget.widgetType != WidgetTypeEnum.button {continue}
|
||||
let isSlidableButton = widget.buttonTriggerMode == ButtonTriggerMode.slideToToggle.rawValue || widget.buttonTriggerMode == ButtonTriggerMode.slideAndHold.rawValue
|
||||
let pointInSubview = widget.convert(locationInSuperView, from: self.superview)
|
||||
if widget.bounds.contains(pointInSubview){
|
||||
setLock.lock()
|
||||
let captured = widget.capturedTouches.contains(touch)
|
||||
setLock.unlock()
|
||||
if captured || widget.slideMode == ButtonSlideMode.disabled.rawValue {continue}
|
||||
if captured || !isSlidableButton
|
||||
{continue}
|
||||
setLock.lock()
|
||||
widget.capturedTouches.add(touch)
|
||||
setLock.unlock()
|
||||
@@ -1436,15 +1449,15 @@ import UIKit
|
||||
setLock.lock()
|
||||
let captured = widget.capturedTouches.contains(touch)
|
||||
setLock.unlock()
|
||||
if !captured || widget.slideMode == ButtonSlideMode.disabled.rawValue {continue}
|
||||
if !captured || !isSlidableButton {continue}
|
||||
// print("UIButton: \(widget.buttonLabel) out test, \(widget.touchPadString), \(CACurrentMediaTime())")
|
||||
if(widget.slideMode == ButtonSlideMode.toggle.rawValue){
|
||||
if(widget.buttonTriggerMode == ButtonTriggerMode.slideToToggle.rawValue){
|
||||
widget.handleFingerUpOrSlideout()
|
||||
setLock.lock()
|
||||
widget.capturedTouches.remove(touch)
|
||||
setLock.unlock()
|
||||
}
|
||||
if(widget.slideMode == ButtonSlideMode.slideAndHold.rawValue){
|
||||
if(widget.buttonTriggerMode == ButtonTriggerMode.slideAndHold.rawValue){
|
||||
// do nothing here
|
||||
}
|
||||
}
|
||||
@@ -1462,10 +1475,10 @@ import UIKit
|
||||
}
|
||||
|
||||
if self.widgetType == WidgetTypeEnum.button {
|
||||
if self.slideMode != ButtonSlideMode.disabled.rawValue {self.handleButtonSliding(touches: touches)}
|
||||
if self.buttonTriggerMode == ButtonTriggerMode.slideToToggle.rawValue || self.buttonTriggerMode == ButtonTriggerMode.slideAndHold.rawValue {self.handleButtonSliding(touches: touches)}
|
||||
}
|
||||
|
||||
if CommandManager.specialOverlayButtonCmds.contains(self.cmdString){
|
||||
if !Set(CommandManager.specialOverlayButtonCmds).isDisjoint(with: Set(self.comboButtonStrings)){
|
||||
if let touch = touches.first {
|
||||
NSLog("touchTapTimeStamp %f", self.touchTapTimeStamp)
|
||||
if CACurrentMediaTime() - self.touchTapTimeStamp > 0.3 { // temporarily relocate special buttons
|
||||
@@ -1664,13 +1677,15 @@ import UIKit
|
||||
}
|
||||
|
||||
if !OnScreenWidgetView.editMode && !self.cmdString.contains("+") && !self.comboButtonStrings.isEmpty { // if the command(keystring contains "+", it's a legacy multi-key command
|
||||
self.handleFingerUpAfterSliding(touches: touches)
|
||||
setLock.lock()
|
||||
self.capturedTouches.minus(touches)
|
||||
setLock.unlock()
|
||||
if self.buttonTriggerMode == ButtonTriggerMode.slideToToggle.rawValue || self.buttonTriggerMode == ButtonTriggerMode.slideAndHold.rawValue {
|
||||
self.handleFingerUpAfterSliding(touches: touches)
|
||||
setLock.lock()
|
||||
self.capturedTouches.minus(touches)
|
||||
setLock.unlock()
|
||||
}
|
||||
}
|
||||
|
||||
if !OnScreenWidgetView.editMode && CommandManager.specialOverlayButtonCmds.contains(self.cmdString){
|
||||
if !OnScreenWidgetView.editMode && !Set(CommandManager.specialOverlayButtonCmds).isDisjoint(with: Set(self.comboButtonStrings)){
|
||||
if CACurrentMediaTime() - self.touchTapTimeStamp < 0.3 {
|
||||
switch self.cmdString {
|
||||
case "SETTINGS":
|
||||
@@ -1719,7 +1734,16 @@ import UIKit
|
||||
}
|
||||
}
|
||||
|
||||
self.handleFingerUpOrSlideout()
|
||||
if self.buttonTriggerMode != ButtonTriggerMode.tapToToggle.rawValue {self.handleFingerUpOrSlideout()}
|
||||
}
|
||||
|
||||
override func didMoveToSuperview() {
|
||||
super.didMoveToSuperview()
|
||||
if superview == nil {
|
||||
self.handleFingerUpOrSlideout()
|
||||
crossMarkLayer.removeFromSuperlayer()
|
||||
stickBallLayer.removeFromSuperlayer()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -515,7 +515,7 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5;
|
||||
widgetView.trackballDecelerationRate = buttonState.decelerationRate;
|
||||
widgetView.stickIndicatorOffset = buttonState.stickIndicatorOffset;
|
||||
widgetView.minStickOffset = buttonState.minStickOffset;
|
||||
widgetView.slideMode = buttonState.slideMode;
|
||||
widgetView.buttonTriggerMode = buttonState.buttonTriggerMode;
|
||||
// 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];
|
||||
|
||||
+2
-2
@@ -94,8 +94,8 @@ 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 (strong, nonatomic) IBOutlet UIStackView *triggerModeStack;
|
||||
@property (strong, nonatomic) IBOutlet UISegmentedControl *triggerModeSelector;
|
||||
|
||||
@property (strong, nonatomic) IBOutlet UIStackView *autoTapStack;
|
||||
@property (strong, nonatomic) IBOutlet UILabel *autoTapLabel;
|
||||
|
||||
+8
-22
@@ -140,7 +140,7 @@
|
||||
widgetView.trackballDecelerationRate = buttonState.decelerationRate;
|
||||
widgetView.stickIndicatorOffset = buttonState.stickIndicatorOffset;
|
||||
widgetView.minStickOffset = buttonState.minStickOffset;
|
||||
widgetView.slideMode = buttonState.slideMode;
|
||||
widgetView.buttonTriggerMode = buttonState.buttonTriggerMode;
|
||||
// Add the widgetView to the view controller's view
|
||||
[self.view insertSubview:widgetView belowSubview:self.widgetPanelStack];
|
||||
buttonState.position = [self denormalizeWidgetPosition:buttonState.position];
|
||||
@@ -589,7 +589,6 @@
|
||||
[widgetInitParams setObject: alertController.textFields[1].text forKey:@"buttonLabel"];
|
||||
[widgetInitParams setObject: alertController.textFields[2].text forKey:@"minStickOffsetString"];
|
||||
[widgetInitParams setObject: alertController.textFields[3].text forKey:@"shape"];
|
||||
[self removeStickIndicators];
|
||||
[self updateWidget:self->selectedWidgetView byParams:widgetInitParams createNew:false];
|
||||
}];
|
||||
|
||||
@@ -648,7 +647,7 @@
|
||||
newWidget.minStickOffset = [widgetInitParams[@"minStickOffsetString"] floatValue];
|
||||
[newWidget setVibrationWithStyle:widget.vibrationStyle];
|
||||
newWidget.mouseButtonAction = widget.mouseButtonAction;
|
||||
newWidget.slideMode = widget.slideMode;
|
||||
newWidget.buttonTriggerMode = widget.buttonTriggerMode;
|
||||
[self.view insertSubview:newWidget belowSubview:self.widgetPanelStack];
|
||||
|
||||
if(createNew) [newWidget setLocationWithPosition:CGPointMake(90, 130)];
|
||||
@@ -732,18 +731,6 @@
|
||||
OnScreenWidgetView* widget = (OnScreenWidgetView* )view;
|
||||
[widget.crossMarkLayer setHidden:true];
|
||||
[widget.stickBallLayer setHidden:true];
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)removeStickIndicators{
|
||||
for(UIView* view in self.view.subviews){
|
||||
if([view isKindOfClass:[OnScreenWidgetView class]]){
|
||||
OnScreenWidgetView* widget = (OnScreenWidgetView* )view;
|
||||
[widget.crossMarkLayer removeFromSuperlayer];
|
||||
[widget.stickBallLayer removeFromSuperlayer];
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -781,7 +768,7 @@
|
||||
|
||||
// hide irrelevant stacks
|
||||
self.autoTapStack.hidden = selectedWidgetView.widgetType != WidgetTypeEnumButton;
|
||||
self.slidableStack.hidden = selectedWidgetView.widgetType != WidgetTypeEnumButton;
|
||||
self.triggerModeStack.hidden = selectedWidgetView.widgetType != WidgetTypeEnumButton;
|
||||
|
||||
bool showSensitivityFactorStack = selectedWidgetView.hasSensitivityTweak;
|
||||
bool showStickIndicatorOffsetStack = selectedWidgetView.hasStickIndicator;
|
||||
@@ -853,7 +840,7 @@
|
||||
[self decelerationRateSliderMoved:self.decelerationRateSlider];
|
||||
|
||||
self.mouseButtonDownSelector.selectedSegmentIndex = selectedWidgetView.mouseButtonAction;
|
||||
[self.slidableSelector setSelectedSegmentIndex:selectedWidgetView.slideMode];
|
||||
[self.triggerModeSelector setSelectedSegmentIndex:selectedWidgetView.buttonTriggerMode];
|
||||
|
||||
if([self isIPhone]){
|
||||
self.vibrationStyleStack.hidden =
|
||||
@@ -972,7 +959,7 @@
|
||||
|
||||
- (void)slideModeChanged:(UISegmentedControl* )sender{
|
||||
if(self->selectedWidgetView != nil && self->widgetViewSelected){
|
||||
selectedWidgetView.slideMode = _slidableSelector.selectedSegmentIndex;
|
||||
selectedWidgetView.buttonTriggerMode = _triggerModeSelector.selectedSegmentIndex;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1152,9 +1139,9 @@
|
||||
[self.mouseButtonDownSelector setTitleTextAttributes:whiteFontAttributes forState:UIControlStateNormal];
|
||||
self.mouseDownButtonStack.hidden = YES;
|
||||
|
||||
[self.slidableSelector addTarget:self action:@selector(slideModeChanged:) forControlEvents:(UIControlEventValueChanged)];
|
||||
[self.slidableSelector setTitleTextAttributes:whiteFontAttributes forState:UIControlStateNormal];
|
||||
self.slidableStack.hidden = YES;
|
||||
[self.triggerModeSelector addTarget:self action:@selector(slideModeChanged:) forControlEvents:(UIControlEventValueChanged)];
|
||||
[self.triggerModeSelector setTitleTextAttributes:whiteFontAttributes forState:UIControlStateNormal];
|
||||
self.triggerModeStack.hidden = YES;
|
||||
|
||||
|
||||
if([self isIPhone]){
|
||||
@@ -1413,7 +1400,6 @@
|
||||
if(!isToolbarHidden && self->selectedWidgetView != nil && [self layerIsOverlappingWithTrashcanButton:selectedWidgetView.layer]){
|
||||
[self->selectedWidgetView removeFromSuperview];
|
||||
[self.onScreenWidgetViews removeObject:self->selectedWidgetView];
|
||||
[self removeStickIndicators];
|
||||
[selectedWidgetView.buttonDownVisualEffectLayer removeFromSuperlayer];
|
||||
}
|
||||
|
||||
|
||||
@@ -1334,30 +1334,30 @@
|
||||
}
|
||||
},
|
||||
"cKS-fy-Zpg.segmentTitles[0]" : {
|
||||
"comment" : "Class = \"UISegmentedControl\"; cKS-fy-Zpg.segmentTitles[0] = \"slide to release\"; ObjectID = \"cKS-fy-Zpg\";",
|
||||
"comment" : "Class = \"UISegmentedControl\"; cKS-fy-Zpg.segmentTitles[0] = \"slide to toggle\"; ObjectID = \"cKS-fy-Zpg\";",
|
||||
"extractionState" : "extracted_with_value",
|
||||
"localizations" : {
|
||||
"en" : {
|
||||
"stringUnit" : {
|
||||
"state" : "new",
|
||||
"value" : "slide to release"
|
||||
"value" : "slide to toggle"
|
||||
}
|
||||
},
|
||||
"zh-Hans" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"state" : "needs_review",
|
||||
"value" : "滑出时松开"
|
||||
}
|
||||
},
|
||||
"zh-Hant" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"state" : "needs_review",
|
||||
"value" : "滑出時鬆開"
|
||||
}
|
||||
},
|
||||
"zh-HK" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"state" : "needs_review",
|
||||
"value" : "滑出時鬆開"
|
||||
}
|
||||
}
|
||||
@@ -1394,31 +1394,61 @@
|
||||
}
|
||||
},
|
||||
"cKS-fy-Zpg.segmentTitles[2]" : {
|
||||
"comment" : "Class = \"UISegmentedControl\"; cKS-fy-Zpg.segmentTitles[2] = \"disabled\"; ObjectID = \"cKS-fy-Zpg\";",
|
||||
"comment" : "Class = \"UISegmentedControl\"; cKS-fy-Zpg.segmentTitles[2] = \"regular\"; ObjectID = \"cKS-fy-Zpg\";",
|
||||
"extractionState" : "extracted_with_value",
|
||||
"localizations" : {
|
||||
"en" : {
|
||||
"stringUnit" : {
|
||||
"state" : "new",
|
||||
"value" : "disabled"
|
||||
"value" : "regular"
|
||||
}
|
||||
},
|
||||
"zh-Hans" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "关闭"
|
||||
"value" : "常规模式"
|
||||
}
|
||||
},
|
||||
"zh-Hant" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "關閉"
|
||||
"value" : "一般模式"
|
||||
}
|
||||
},
|
||||
"zh-HK" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "關閉\n"
|
||||
"value" : "一般模式"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"cKS-fy-Zpg.segmentTitles[3]" : {
|
||||
"comment" : "Class = \"UISegmentedControl\"; cKS-fy-Zpg.segmentTitles[3] = \"tap to toggle\"; ObjectID = \"cKS-fy-Zpg\";",
|
||||
"extractionState" : "extracted_with_value",
|
||||
"localizations" : {
|
||||
"en" : {
|
||||
"stringUnit" : {
|
||||
"state" : "new",
|
||||
"value" : "tap to toggle"
|
||||
}
|
||||
},
|
||||
"zh-Hans" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "点按切换"
|
||||
}
|
||||
},
|
||||
"zh-Hant" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "點按切換"
|
||||
}
|
||||
},
|
||||
"zh-HK" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "點按切換"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3242,31 +3272,31 @@
|
||||
}
|
||||
},
|
||||
"qNQ-fB-jhY.text" : {
|
||||
"comment" : "Class = \"UILabel\"; text = \"Slide activated\"; ObjectID = \"qNQ-fB-jhY\";",
|
||||
"comment" : "Class = \"UILabel\"; text = \"Trigger mode\"; ObjectID = \"qNQ-fB-jhY\";",
|
||||
"extractionState" : "extracted_with_value",
|
||||
"localizations" : {
|
||||
"en" : {
|
||||
"stringUnit" : {
|
||||
"state" : "new",
|
||||
"value" : "Slide activated"
|
||||
"value" : "Trigger mode"
|
||||
}
|
||||
},
|
||||
"zh-Hans" : {
|
||||
"stringUnit" : {
|
||||
"state" : "needs_review",
|
||||
"value" : "滑动触发"
|
||||
"state" : "translated",
|
||||
"value" : "触发模式"
|
||||
}
|
||||
},
|
||||
"zh-Hant" : {
|
||||
"stringUnit" : {
|
||||
"state" : "needs_review",
|
||||
"value" : "滑動觸發"
|
||||
"state" : "translated",
|
||||
"value" : "觸發模式"
|
||||
}
|
||||
},
|
||||
"zh-HK" : {
|
||||
"stringUnit" : {
|
||||
"state" : "needs_review",
|
||||
"value" : "滑動觸發"
|
||||
"state" : "translated",
|
||||
"value" : "觸發模式"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2312,13 +2312,13 @@
|
||||
}
|
||||
},
|
||||
"o9I-Gt-YRd.text" : {
|
||||
"comment" : "Class = \"UILabel\"; text = \"Slide activated\"; ObjectID = \"o9I-Gt-YRd\";",
|
||||
"comment" : "Class = \"UILabel\"; text = \"Trigger Mode\"; ObjectID = \"o9I-Gt-YRd\";",
|
||||
"extractionState" : "extracted_with_value",
|
||||
"localizations" : {
|
||||
"en" : {
|
||||
"stringUnit" : {
|
||||
"state" : "new",
|
||||
"value" : "Slide activated"
|
||||
"value" : "Trigger Mode"
|
||||
}
|
||||
},
|
||||
"zh-Hans" : {
|
||||
@@ -2402,13 +2402,13 @@
|
||||
}
|
||||
},
|
||||
"ojp-aS-m8w.segmentTitles[0]" : {
|
||||
"comment" : "Class = \"UISegmentedControl\"; ojp-aS-m8w.segmentTitles[0] = \"slide to release\"; ObjectID = \"ojp-aS-m8w\";",
|
||||
"comment" : "Class = \"UISegmentedControl\"; ojp-aS-m8w.segmentTitles[0] = \"slide to toggle\"; ObjectID = \"ojp-aS-m8w\";",
|
||||
"extractionState" : "extracted_with_value",
|
||||
"localizations" : {
|
||||
"en" : {
|
||||
"stringUnit" : {
|
||||
"state" : "new",
|
||||
"value" : "slide to release"
|
||||
"value" : "slide to toggle"
|
||||
}
|
||||
},
|
||||
"zh-Hans" : {
|
||||
@@ -2462,31 +2462,61 @@
|
||||
}
|
||||
},
|
||||
"ojp-aS-m8w.segmentTitles[2]" : {
|
||||
"comment" : "Class = \"UISegmentedControl\"; ojp-aS-m8w.segmentTitles[2] = \"disabled\"; ObjectID = \"ojp-aS-m8w\";",
|
||||
"comment" : "Class = \"UISegmentedControl\"; ojp-aS-m8w.segmentTitles[2] = \"regular\"; ObjectID = \"ojp-aS-m8w\";",
|
||||
"extractionState" : "extracted_with_value",
|
||||
"localizations" : {
|
||||
"en" : {
|
||||
"stringUnit" : {
|
||||
"state" : "new",
|
||||
"value" : "disabled"
|
||||
"value" : "regular"
|
||||
}
|
||||
},
|
||||
"zh-Hans" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "关闭"
|
||||
"value" : "常规模式"
|
||||
}
|
||||
},
|
||||
"zh-Hant" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "關閉"
|
||||
"value" : "一般模式"
|
||||
}
|
||||
},
|
||||
"zh-HK" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "關閉"
|
||||
"value" : "一般模式"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"ojp-aS-m8w.segmentTitles[3]" : {
|
||||
"comment" : "Class = \"UISegmentedControl\"; ojp-aS-m8w.segmentTitles[3] = \"tap to toggle\"; ObjectID = \"ojp-aS-m8w\";",
|
||||
"extractionState" : "extracted_with_value",
|
||||
"localizations" : {
|
||||
"en" : {
|
||||
"stringUnit" : {
|
||||
"state" : "new",
|
||||
"value" : "tap to toggle"
|
||||
}
|
||||
},
|
||||
"zh-Hans" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "点按切换"
|
||||
}
|
||||
},
|
||||
"zh-Hant" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "點按切換"
|
||||
}
|
||||
},
|
||||
"zh-HK" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "點按切換"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user