relativeTouch improvements:

- fix micro move issue
- fix clumsy move in portrait mode
This commit is contained in:
TrueZhuanjia committed 2025-07-01 23:49:02 +08:00
1 parent d0eb864814
commit 620385501f
3 files changed
+10 -4

No files matched your search

-1
View File
@@ -111,7 +111,6 @@ typedef NS_ENUM(NSInteger, OnScreenControlsLevel) {
+ (NSMutableSet* )touchAddrsCapturedByOnScreenControls; + (NSMutableSet* )touchAddrsCapturedByOnScreenControls;
+ (void) testMethod;
- (void) sendRightStickTouchPadEvent:(CGFloat) stickX : (CGFloat) stickY; - (void) sendRightStickTouchPadEvent:(CGFloat) stickX : (CGFloat) stickY;
- (void) clearRightStickTouchPadFlag; - (void) clearRightStickTouchPadFlag;
- (void) sendLeftStickTouchPadEvent:(CGFloat) stickX : (CGFloat) stickY; - (void) sendLeftStickTouchPadEvent:(CGFloat) stickX : (CGFloat) stickY;
-1
View File
@@ -22,7 +22,6 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, strong) CADisplayLink *displayLink; @property (nonatomic, strong) CADisplayLink *displayLink;
+ (void) testMethod;
- (id)initWithView:(StreamView*)view andSettings:(TemporarySettings*)settings; - (id)initWithView:(StreamView*)view andSettings:(TemporarySettings*)settings;
@end @end
+10 -2
View File
@@ -23,6 +23,7 @@ static const float QUICK_TAP_TIME_INTERVAL = 0.2;
CGPoint twoFingerTouchLocation; CGPoint twoFingerTouchLocation;
NSTimeInterval mousePointerTimestamp; NSTimeInterval mousePointerTimestamp;
CGRect streamViewBounds; CGRect streamViewBounds;
BOOL firstTouchMoved;
BOOL mousePointerMoved; BOOL mousePointerMoved;
BOOL quickTapDetected; BOOL quickTapDetected;
BOOL isInMouseWheelScrollingMode; BOOL isInMouseWheelScrollingMode;
@@ -57,6 +58,7 @@ static const float QUICK_TAP_TIME_INTERVAL = 0.2;
[self->streamView.streamFrameTopLayerView addGestureRecognizer:_mouseRightClickTapRecognizer]; // add all additional gestures to the streamFrameTopLayerView instead of the streamview. [self->streamView.streamFrameTopLayerView addGestureRecognizer:_mouseRightClickTapRecognizer]; // add all additional gestures to the streamFrameTopLayerView instead of the streamview.
isInMouseWheelScrollingMode = false; isInMouseWheelScrollingMode = false;
firstTouchMoved = false;
mousePointerMoved = false; mousePointerMoved = false;
mousePointerTimestamp = 0; mousePointerTimestamp = 0;
@@ -141,6 +143,7 @@ static const float QUICK_TAP_TIME_INTERVAL = 0.2;
return; return;
} }
firstTouchMoved = false;
touchPointSpawnedAtUpperScreenEdge = false; // reset this flag immediately if we get a touch event passing the check above, this fixes irresponsive touch after closing the command tool menu. touchPointSpawnedAtUpperScreenEdge = false; // reset this flag immediately if we get a touch event passing the check above, this fixes irresponsive touch after closing the command tool menu.
if([[event allTouches] count] == 2 && ![self isOnScreenWidgetViewBeingPressed] && ![self isOnScreenControllerBeingPressed:[event allTouches]]){ if([[event allTouches] count] == 2 && ![self isOnScreenWidgetViewBeingPressed] && ![self isOnScreenControllerBeingPressed:[event allTouches]]){
@@ -246,11 +249,16 @@ static const float QUICK_TAP_TIME_INTERVAL = 0.2;
CGPoint currentLocation = [touch locationInView:self->streamView]; CGPoint currentLocation = [touch locationInView:self->streamView];
if (!self->firstTouchMoved) {
self->latestMousePointerLocation = currentLocation;
self->firstTouchMoved = true;
}
if (self->latestMousePointerLocation.x != currentLocation.x || if (self->latestMousePointerLocation.x != currentLocation.x ||
self->latestMousePointerLocation.y != currentLocation.y) self->latestMousePointerLocation.y != currentLocation.y)
{ {
int deltaX = (currentLocation.x - self->latestMousePointerLocation.x) * (REFERENCE_WIDTH / self->streamViewBounds.size.width) * self->currentSettings.mousePointerVelocityFactor.floatValue; int deltaX = (currentLocation.x - self->latestMousePointerLocation.x) * 1.35 * self->currentSettings.mousePointerVelocityFactor.floatValue;
int deltaY = (currentLocation.y - self->latestMousePointerLocation.y) * (REFERENCE_HEIGHT / self->streamViewBounds.size.height) * self->currentSettings.mousePointerVelocityFactor.floatValue; int deltaY = (currentLocation.y - self->latestMousePointerLocation.y) * 1.35 * self->currentSettings.mousePointerVelocityFactor.floatValue;
if (deltaX != 0 || deltaY != 0) { if (deltaX != 0 || deltaY != 0) {
LiSendMouseMoveEvent(deltaX, deltaY); LiSendMouseMoveEvent(deltaX, deltaY);