fixed: undoRelocation not working for widget just collected by folder button
This commit is contained in:
1 parent
1a719e11e6
commit
286b5e94e6
1 file changed
+23
-22
@@ -401,7 +401,7 @@ import ObjectiveC.runtime
|
|||||||
private var mousePointerMoved: Bool
|
private var mousePointerMoved: Bool
|
||||||
private var twoTouchesDetected: Bool
|
private var twoTouchesDetected: Bool
|
||||||
private var scrollEventSent: Bool = false
|
private var scrollEventSent: Bool = false
|
||||||
private var allSpawnedTouchesCount: Int = 0
|
private var activeTouchesCount: Int = 0
|
||||||
|
|
||||||
// trackball
|
// trackball
|
||||||
private var trackballVelocity: CGPoint = .zero
|
private var trackballVelocity: CGPoint = .zero
|
||||||
@@ -2056,10 +2056,6 @@ import ObjectiveC.runtime
|
|||||||
//==============================================================================
|
//==============================================================================
|
||||||
// Touch event handling
|
// Touch event handling
|
||||||
|
|
||||||
private func getAllSpawnedTouchesCount(with event: UIEvent?)->Int{
|
|
||||||
return UITouchUtil.touches(in: self, from: event).count
|
|
||||||
}
|
|
||||||
|
|
||||||
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
|
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
|
||||||
|
|
||||||
self.touchBegan = true
|
self.touchBegan = true
|
||||||
@@ -2101,8 +2097,8 @@ import ObjectiveC.runtime
|
|||||||
self.latestTouchLocation = touchBeganLocation
|
self.latestTouchLocation = touchBeganLocation
|
||||||
}
|
}
|
||||||
|
|
||||||
allSpawnedTouchesCount = UITouchUtil.touches(in: self, from: event).count // this will counts all valid touches within the self widgetView, and excludes touches in other widgetViews
|
activeTouchesCount = UITouchUtil.touches(in: self, from: event).count // this will counts all valid touches within the self widgetView, and excludes touches in other widgetViews
|
||||||
if allSpawnedTouchesCount == 2 {
|
if activeTouchesCount == 2 {
|
||||||
self.twoTouchesDetected = true
|
self.twoTouchesDetected = true
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2136,7 +2132,7 @@ import ObjectiveC.runtime
|
|||||||
self.showl3r3Indicator()
|
self.showl3r3Indicator()
|
||||||
self.sendComboButtonsDownEvent(comboStrings: self.comboButtonStrings)}
|
self.sendComboButtonsDownEvent(comboStrings: self.comboButtonStrings)}
|
||||||
case "DPAD", "WASDPAD", "ARROWPAD":
|
case "DPAD", "WASDPAD", "ARROWPAD":
|
||||||
if allSpawnedTouchesCount == 1 {
|
if activeTouchesCount == 1 {
|
||||||
// showLrudBall(at: touchBeganLocation)
|
// showLrudBall(at: touchBeganLocation)
|
||||||
CATransaction.begin()
|
CATransaction.begin()
|
||||||
CATransaction.setDisableActions(true)
|
CATransaction.setDisableActions(true)
|
||||||
@@ -2160,7 +2156,7 @@ import ObjectiveC.runtime
|
|||||||
}
|
}
|
||||||
case "MAGNIFIER":
|
case "MAGNIFIER":
|
||||||
GenericUtils.handleMagnifierTip(in: self.parentViewController)
|
GenericUtils.handleMagnifierTip(in: self.parentViewController)
|
||||||
if quickDoubleTapDetected && allSpawnedTouchesCount == 1 {
|
if quickDoubleTapDetected && activeTouchesCount == 1 {
|
||||||
OnScreenWidgetView.profileChangedDuringStreaming = true
|
OnScreenWidgetView.profileChangedDuringStreaming = true
|
||||||
self.functionalWidgetDelegate?.resetMagnifierStreamView(animated: self.animatesTransition)
|
self.functionalWidgetDelegate?.resetMagnifierStreamView(animated: self.animatesTransition)
|
||||||
}
|
}
|
||||||
@@ -2168,7 +2164,7 @@ import ObjectiveC.runtime
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.widgetType == WidgetTypeEnum.touchPad && CommandManager.mousePadWithButtonActions.contains(self.touchPadString) && allSpawnedTouchesCount == 1 && !twoTouchesDetected {
|
if self.widgetType == WidgetTypeEnum.touchPad && CommandManager.mousePadWithButtonActions.contains(self.touchPadString) && activeTouchesCount == 1 && !twoTouchesDetected {
|
||||||
self.handleMousePadButtonActionDown(touch: touch)
|
self.handleMousePadButtonActionDown(touch: touch)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2259,7 +2255,7 @@ import ObjectiveC.runtime
|
|||||||
if self.hasTrackPoint, OnScreenWidgetView.trackPointEnabled {
|
if self.hasTrackPoint, OnScreenWidgetView.trackPointEnabled {
|
||||||
CATransaction.begin()
|
CATransaction.begin()
|
||||||
CATransaction.setDisableActions(true)
|
CATransaction.setDisableActions(true)
|
||||||
let trackPointGap = allSpawnedTouchesCount - trackPointPool.count
|
let trackPointGap = activeTouchesCount - trackPointPool.count
|
||||||
if trackPointGap > 0 {
|
if trackPointGap > 0 {
|
||||||
for _ in 0..<trackPointGap {
|
for _ in 0..<trackPointGap {
|
||||||
trackPointPool.insert(GraphicUtils.makeTouchTrackpoint(in: self))
|
trackPointPool.insert(GraphicUtils.makeTouchTrackpoint(in: self))
|
||||||
@@ -2555,7 +2551,7 @@ import ObjectiveC.runtime
|
|||||||
|
|
||||||
private func handleTouchPadMoveEvent (_ touches: Set<UITouch>, with event: UIEvent?){
|
private func handleTouchPadMoveEvent (_ touches: Set<UITouch>, with event: UIEvent?){
|
||||||
guard let touch = touches.first else { return }
|
guard let touch = touches.first else { return }
|
||||||
let activeTouchesCount = UITouchUtil.touches(in: self, from: event).count
|
// let activeTouchesCount = UITouchUtil.touches(in: self, from: event).count
|
||||||
if activeTouchesCount == 1 { // don't use event.alltouches.count here, it will counts all touches
|
if activeTouchesCount == 1 { // don't use event.alltouches.count here, it will counts all touches
|
||||||
self.getVector(touch: touch)
|
self.getVector(touch: touch)
|
||||||
switch self.touchPadString{
|
switch self.touchPadString{
|
||||||
@@ -3044,23 +3040,17 @@ import ObjectiveC.runtime
|
|||||||
|
|
||||||
if !(CommandManager.mousePadWithButtonActions.contains(self.touchPadString) && self.mouseButtonAction != .noClick) {quickDoubleTapDetected = false} //do not reset this flag here in mousePad mode with button actions
|
if !(CommandManager.mousePadWithButtonActions.contains(self.touchPadString) && 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.activeTouchesCount = UITouchUtil.touches(in: self, from: event).count // this will counts all valid touches within the self widgetView, and excludes touches in other widgetViews
|
||||||
|
|
||||||
|
|
||||||
// deal with pure MOUSPAD first
|
// deal with pure MOUSPAD first
|
||||||
if !OnScreenWidgetView.editMode && self.widgetType == WidgetTypeEnum.touchPad && CommandManager.mousePadWithButtonActions.contains(self.touchPadString) && allSpawnedTouchesCount == 1 && !twoTouchesDetected {
|
if !OnScreenWidgetView.editMode && self.widgetType == WidgetTypeEnum.touchPad && CommandManager.mousePadWithButtonActions.contains(self.touchPadString) && activeTouchesCount == 1 && !twoTouchesDetected {
|
||||||
self.handleMousePadButtonActionUp()
|
self.handleMousePadButtonActionUp()
|
||||||
}
|
}
|
||||||
if !OnScreenWidgetView.editMode && self.widgetType == WidgetTypeEnum.touchPad && CommandManager.mousePadWithButtonActions.contains(self.touchPadString) && twoTouchesDetected && touches.count == allSpawnedTouchesCount { // need to enable multi-touch first
|
if !OnScreenWidgetView.editMode && self.widgetType == WidgetTypeEnum.touchPad && CommandManager.mousePadWithButtonActions.contains(self.touchPadString) && twoTouchesDetected && touches.count == activeTouchesCount { // need to enable multi-touch first
|
||||||
// touches.count == allCapturedTouchesCount means allfingers are lifting
|
// touches.count == allCapturedTouchesCount means allfingers are lifting
|
||||||
if self.mouseButtonAction == MouseButtonAction.hovering, !scrollEventSent {self.sendMouseRightButtonClickEvent()}
|
if self.mouseButtonAction == MouseButtonAction.hovering, !scrollEventSent {self.sendMouseRightButtonClickEvent()}
|
||||||
}
|
}
|
||||||
if touches.count == allSpawnedTouchesCount {
|
|
||||||
firstTouchMoved = false
|
|
||||||
twoTouchesDetected = false
|
|
||||||
scrollEventSent = false
|
|
||||||
twoTouchesDetected = false
|
|
||||||
}
|
|
||||||
|
|
||||||
// then other types of pads or buttons with touchPad function
|
// then other types of pads or buttons with touchPad function
|
||||||
if !OnScreenWidgetView.editMode && !self.touchPadString.isEmpty {
|
if !OnScreenWidgetView.editMode && !self.touchPadString.isEmpty {
|
||||||
@@ -3142,7 +3132,7 @@ import ObjectiveC.runtime
|
|||||||
}
|
}
|
||||||
else {self.clearRightStickTouchPadFlag()}
|
else {self.clearRightStickTouchPadFlag()}
|
||||||
case "TRACKBALL":
|
case "TRACKBALL":
|
||||||
if allSpawnedTouchesCount == 1, self.inertiaEnabled() {
|
if activeTouchesCount == 1, self.inertiaEnabled() {
|
||||||
if(mousePointerMoved){
|
if(mousePointerMoved){
|
||||||
self.startTrackballMomentum()
|
self.startTrackballMomentum()
|
||||||
mousePointerMoved = false //reset flag
|
mousePointerMoved = false //reset flag
|
||||||
@@ -3245,7 +3235,12 @@ import ObjectiveC.runtime
|
|||||||
CATransaction.commit()
|
CATransaction.commit()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// clear generic bool flags for streaming mode
|
||||||
self.temporarilyMovable = false
|
self.temporarilyMovable = false
|
||||||
|
if touches.count == activeTouchesCount {
|
||||||
|
twoTouchesDetected = false
|
||||||
|
scrollEventSent = false
|
||||||
|
}
|
||||||
|
|
||||||
CATransaction.commit()
|
CATransaction.commit()
|
||||||
|
|
||||||
@@ -3313,6 +3308,12 @@ import ObjectiveC.runtime
|
|||||||
OnScreenWidgetView.isHorizontallyAligned = false
|
OnScreenWidgetView.isHorizontallyAligned = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// clear bool flags for streaming & edit mode
|
||||||
|
if touches.count == activeTouchesCount {
|
||||||
|
firstTouchMoved = false
|
||||||
|
}
|
||||||
|
|
||||||
OnScreenWidgetView.capturer = nil
|
OnScreenWidgetView.capturer = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user