From 19882a9373c4c2f3dc14329520434462ed9b566a Mon Sep 17 00:00:00 2001 From: TrueZhuanjia Date: Wed, 2 Jul 2025 00:07:47 +0800 Subject: [PATCH] osw mousePad improvement: micro move fix --- VoidLink/Input/OnScreenWidgetView.swift | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/VoidLink/Input/OnScreenWidgetView.swift b/VoidLink/Input/OnScreenWidgetView.swift index 6d4ff4f1..78bb350e 100644 --- a/VoidLink/Input/OnScreenWidgetView.swift +++ b/VoidLink/Input/OnScreenWidgetView.swift @@ -117,6 +117,7 @@ import UIKit // for mousePad private var touchLockedForMoveEvent: UITouch private var touchBegan: Bool = false + private var firstTouchMoved: Bool = false private var mousePointerMoved: Bool private var twoTouchesDetected: Bool @@ -975,6 +976,7 @@ import UIKit override func touchesBegan(_ touches: Set, 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 @@ -1134,6 +1136,11 @@ import UIKit private func updateTouchLocation (touch: UITouch) { self.mousePointerMoved = true 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.deltaY = currentTouchLocation.y - self.latestTouchLocation.y self.offSetX = currentTouchLocation.x - self.touchBeganLocation.x