- feat: hybrid form for mousePad & LT/RT Pad
This commit is contained in:
1 parent
11b79dda5b
commit
e44504bc48
1 file changed
+32
-28
@@ -636,6 +636,8 @@ import UIKit
|
|||||||
setupButtonDownVisualEffectLayer();
|
setupButtonDownVisualEffectLayer();
|
||||||
if CommandManager.directionPads.contains(touchPadString) {setupLrudDirectionIndicatorlayers()}
|
if CommandManager.directionPads.contains(touchPadString) {setupLrudDirectionIndicatorlayers()}
|
||||||
if CommandManager.stickTouchPads.contains(touchPadString) {self.l3r3Indicator = createl3r3Indicator()}
|
if CommandManager.stickTouchPads.contains(touchPadString) {self.l3r3Indicator = createl3r3Indicator()}
|
||||||
|
if CommandManager.verticalTouchPads.contains(touchPadString) {self.l3r3Indicator = createl3r3Indicator()}
|
||||||
|
if self.touchPadString == "MOUSEPAD" {self.l3r3Indicator = createl3r3Indicator()}
|
||||||
if self.hasStickIndicator {
|
if self.hasStickIndicator {
|
||||||
if self.crossMarkLayer.superlayer == nil {self.crossMarkLayer = createCrossMark()}
|
if self.crossMarkLayer.superlayer == nil {self.crossMarkLayer = createCrossMark()}
|
||||||
if self.stickBallLayer.superlayer == nil {self.stickBallLayer = createStickBall()}
|
if self.stickBallLayer.superlayer == nil {self.stickBallLayer = createStickBall()}
|
||||||
@@ -1383,25 +1385,16 @@ import UIKit
|
|||||||
if !OnScreenWidgetView.editMode {
|
if !OnScreenWidgetView.editMode {
|
||||||
if self.widgetType == WidgetTypeEnum.touchPad && touches.count == 1{ // don't use event?.allTouches?.count here, it will counts all touches including the ones captured by other UIViews
|
if self.widgetType == WidgetTypeEnum.touchPad && touches.count == 1{ // don't use event?.allTouches?.count here, it will counts all touches including the ones captured by other UIViews
|
||||||
switch self.touchPadString {
|
switch self.touchPadString {
|
||||||
case "LSPAD":
|
case "LSPAD","RSPAD":
|
||||||
self.showStickIndicator()
|
self.showStickIndicator()
|
||||||
if quickDoubleTapDetected {
|
if quickDoubleTapDetected {
|
||||||
self.showl3r3Indicator()
|
self.showl3r3Indicator()
|
||||||
self.sendComboButtonsDownEvent(comboStrings: self.comboButtonStrings)}
|
self.sendComboButtonsDownEvent(comboStrings: self.comboButtonStrings)}
|
||||||
case "RSPAD":
|
case "LSVPAD","RSVPAD","DS4TOUCH":
|
||||||
self.showStickIndicator()
|
|
||||||
if quickDoubleTapDetected {
|
if quickDoubleTapDetected {
|
||||||
self.showl3r3Indicator()
|
self.showl3r3Indicator()
|
||||||
self.sendComboButtonsDownEvent(comboStrings: self.comboButtonStrings)}
|
self.sendComboButtonsDownEvent(comboStrings: self.comboButtonStrings)}
|
||||||
case "LSVPAD":
|
case "DPAD", "WASDPAD", "ARROWPAD":
|
||||||
if quickDoubleTapDetected {
|
|
||||||
self.showl3r3Indicator()
|
|
||||||
self.sendComboButtonsDownEvent(comboStrings: self.comboButtonStrings)}
|
|
||||||
case "RSVPAD":
|
|
||||||
if quickDoubleTapDetected {
|
|
||||||
self.showl3r3Indicator()
|
|
||||||
self.sendComboButtonsDownEvent(comboStrings: self.comboButtonStrings)}
|
|
||||||
case "DPAD", "WASDPAD", "ARROWPAD", "MOUSEWHEEL", "WHEEL":
|
|
||||||
if allSpawnedTouchesCount == 1 {showLrudBall(at: touchBeganLocation)}
|
if allSpawnedTouchesCount == 1 {showLrudBall(at: touchBeganLocation)}
|
||||||
if quickDoubleTapDetected {
|
if quickDoubleTapDetected {
|
||||||
self.sendComboButtonsDownEvent(comboStrings: self.comboButtonStrings)
|
self.sendComboButtonsDownEvent(comboStrings: self.comboButtonStrings)
|
||||||
@@ -1410,8 +1403,8 @@ import UIKit
|
|||||||
self.sendComboButtonsUpEvent(comboStrings: self.comboButtonStrings)
|
self.sendComboButtonsUpEvent(comboStrings: self.comboButtonStrings)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case "DS4TOUCH":
|
case "LTPAD", "RTPAD","MOUSEWHEEL", "WHEEL":
|
||||||
if quickDoubleTapDetected {
|
if quickDoubleTapDetected && !self.comboButtonStrings.isEmpty {
|
||||||
self.showl3r3Indicator()
|
self.showl3r3Indicator()
|
||||||
self.sendComboButtonsDownEvent(comboStrings: self.comboButtonStrings)
|
self.sendComboButtonsDownEvent(comboStrings: self.comboButtonStrings)
|
||||||
}
|
}
|
||||||
@@ -1427,7 +1420,12 @@ import UIKit
|
|||||||
LiSendMouseButtonEvent(CChar(BUTTON_ACTION_PRESS), BUTTON_MIDDLE)
|
LiSendMouseButtonEvent(CChar(BUTTON_ACTION_PRESS), BUTTON_MIDDLE)
|
||||||
case .rightButtonDown:
|
case .rightButtonDown:
|
||||||
LiSendMouseButtonEvent(CChar(BUTTON_ACTION_PRESS), BUTTON_RIGHT)
|
LiSendMouseButtonEvent(CChar(BUTTON_ACTION_PRESS), BUTTON_RIGHT)
|
||||||
case .hovering,.noClick:
|
case .noClick:
|
||||||
|
if quickDoubleTapDetected && !self.comboButtonStrings.isEmpty {
|
||||||
|
self.showl3r3Indicator()
|
||||||
|
self.sendComboButtonsDownEvent(comboStrings: self.comboButtonStrings)
|
||||||
|
}
|
||||||
|
case .hovering:
|
||||||
break
|
break
|
||||||
default:
|
default:
|
||||||
break
|
break
|
||||||
@@ -1539,17 +1537,15 @@ import UIKit
|
|||||||
|
|
||||||
private func handleFingerUpAfterSliding(touches: Set<UITouch>) {
|
private func handleFingerUpAfterSliding(touches: Set<UITouch>) {
|
||||||
for touch in touches {
|
for touch in touches {
|
||||||
for subview in self.superview?.subviews ?? [] {
|
self.forEachWidget(){ widget in
|
||||||
if let widget = subview as? OnScreenWidgetView{
|
setLock.lock()
|
||||||
setLock.lock()
|
let captured = widget.capturedTouches.contains(touch)
|
||||||
let captured = widget.capturedTouches.contains(touch)
|
setLock.unlock()
|
||||||
setLock.unlock()
|
if !captured || widget.buttonMode == ButtonMode.regular.rawValue {return}
|
||||||
if !captured || widget.buttonMode == ButtonMode.regular.rawValue {continue}
|
widget.handleFingerUpOrSlideout()
|
||||||
widget.handleFingerUpOrSlideout()
|
setLock.lock()
|
||||||
setLock.lock()
|
widget.capturedTouches.remove(touch)
|
||||||
widget.capturedTouches.remove(touch)
|
setLock.unlock()
|
||||||
setLock.unlock()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1808,9 +1804,8 @@ import UIKit
|
|||||||
CATransaction.begin()
|
CATransaction.begin()
|
||||||
CATransaction.setDisableActions(true)
|
CATransaction.setDisableActions(true)
|
||||||
|
|
||||||
// for checking stationary touch points
|
|
||||||
|
|
||||||
if self.touchPadString != "MOUSEPAD" {quickDoubleTapDetected = false} //do not reset this flag here in mousePad mode
|
if !(self.touchPadString == "MOUSEPAD" && self.mouseButtonAction != .noClick) {quickDoubleTapDetected = false} //do not reset this flag here in mousePad mode with button actions
|
||||||
|
|
||||||
self.allSpawnedTouchesCount = self.getAllSpawnedTouchesCount(with: event) // this will counts all valid touches within the self widgetView, and excludes touches in other widgetViews
|
self.allSpawnedTouchesCount = self.getAllSpawnedTouchesCount(with: event) // this will counts all valid touches within the self widgetView, and excludes touches in other widgetViews
|
||||||
|
|
||||||
@@ -1834,6 +1829,7 @@ import UIKit
|
|||||||
}
|
}
|
||||||
mousePointerMoved = false // reset this flag
|
mousePointerMoved = false // reset this flag
|
||||||
case .noClick:
|
case .noClick:
|
||||||
|
// quickDoubleTapDetected = false
|
||||||
break
|
break
|
||||||
default:
|
default:
|
||||||
break
|
break
|
||||||
@@ -1907,6 +1903,14 @@ import UIKit
|
|||||||
self.lrudIndicatorBall.isHidden = true
|
self.lrudIndicatorBall.isHidden = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if CommandManager.verticalTouchPads.contains(touchPadString){
|
||||||
|
self.l3r3Indicator.borderColor = UIColor.clear.cgColor
|
||||||
|
}
|
||||||
|
|
||||||
|
if self.touchPadString == "MOUSEPAD" && self.mouseButtonAction == .noClick {
|
||||||
|
self.l3r3Indicator.borderColor = UIColor.clear.cgColor
|
||||||
|
}
|
||||||
|
|
||||||
if !OnScreenWidgetView.editMode && !self.cmdString.contains("+") && !self.comboButtonStrings.isEmpty { // if the command(keystring contains "+", it's a legacy multi-key command
|
if !OnScreenWidgetView.editMode && !self.cmdString.contains("+") && !self.comboButtonStrings.isEmpty { // if the command(keystring contains "+", it's a legacy multi-key command
|
||||||
if self.buttonMode == ButtonMode.slideToToggle.rawValue || self.buttonMode == ButtonMode.slideAndHold.rawValue {
|
if self.buttonMode == ButtonMode.slideToToggle.rawValue || self.buttonMode == ButtonMode.slideAndHold.rawValue {
|
||||||
self.handleFingerUpAfterSliding(touches: touches)
|
self.handleFingerUpAfterSliding(touches: touches)
|
||||||
|
|||||||
Reference in new issue
Block a user