osw mousePad improvement: micro move fix
This commit is contained in:
1 parent
620385501f
commit
19882a9373
1 file changed
+7
@@ -117,6 +117,7 @@ import UIKit
|
|||||||
// for mousePad
|
// for mousePad
|
||||||
private var touchLockedForMoveEvent: UITouch
|
private var touchLockedForMoveEvent: UITouch
|
||||||
private var touchBegan: Bool = false
|
private var touchBegan: Bool = false
|
||||||
|
private var firstTouchMoved: Bool = false
|
||||||
private var mousePointerMoved: Bool
|
private var mousePointerMoved: Bool
|
||||||
private var twoTouchesDetected: Bool
|
private var twoTouchesDetected: Bool
|
||||||
|
|
||||||
@@ -975,6 +976,7 @@ import UIKit
|
|||||||
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
|
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
|
||||||
|
|
||||||
self.touchBegan = true
|
self.touchBegan = true
|
||||||
|
self.firstTouchMoved = false
|
||||||
super.touchesBegan(touches, with: event)
|
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
|
||||||
|
|
||||||
@@ -1134,6 +1136,11 @@ import UIKit
|
|||||||
private func updateTouchLocation (touch: UITouch) {
|
private func updateTouchLocation (touch: UITouch) {
|
||||||
self.mousePointerMoved = true
|
self.mousePointerMoved = true
|
||||||
let currentTouchLocation: CGPoint = (touch.location(in: self))
|
let currentTouchLocation: CGPoint = (touch.location(in: self))
|
||||||
|
if !firstTouchMoved {
|
||||||
|
// First move event
|
||||||
|
self.latestTouchLocation = currentTouchLocation
|
||||||
|
self.firstTouchMoved = true
|
||||||
|
}
|
||||||
self.deltaX = currentTouchLocation.x - self.latestTouchLocation.x
|
self.deltaX = currentTouchLocation.x - self.latestTouchLocation.x
|
||||||
self.deltaY = currentTouchLocation.y - self.latestTouchLocation.y
|
self.deltaY = currentTouchLocation.y - self.latestTouchLocation.y
|
||||||
self.offSetX = currentTouchLocation.x - self.touchBeganLocation.x
|
self.offSetX = currentTouchLocation.x - self.touchBeganLocation.x
|
||||||
|
|||||||
Reference in new issue
Block a user