relativeTouch improvements:

- fix micro move issue
- fix clumsy move in portrait mode
This commit is contained in:
TrueZhuanjia
2025-07-01 23:49:02 +08:00
parent d0eb864814
commit 620385501f
3 changed files with 10 additions and 4 deletions
-1
View File
@@ -111,7 +111,6 @@ typedef NS_ENUM(NSInteger, OnScreenControlsLevel) {
+ (NSMutableSet* )touchAddrsCapturedByOnScreenControls;
+ (void) testMethod;
- (void) sendRightStickTouchPadEvent:(CGFloat) stickX : (CGFloat) stickY;
- (void) clearRightStickTouchPadFlag;
- (void) sendLeftStickTouchPadEvent:(CGFloat) stickX : (CGFloat) stickY;
-1
View File
@@ -22,7 +22,6 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, strong) CADisplayLink *displayLink;
+ (void) testMethod;
- (id)initWithView:(StreamView*)view andSettings:(TemporarySettings*)settings;
@end
+10 -2
View File
@@ -23,6 +23,7 @@ static const float QUICK_TAP_TIME_INTERVAL = 0.2;
CGPoint twoFingerTouchLocation;
NSTimeInterval mousePointerTimestamp;
CGRect streamViewBounds;
BOOL firstTouchMoved;
BOOL mousePointerMoved;
BOOL quickTapDetected;
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.
isInMouseWheelScrollingMode = false;
firstTouchMoved = false;
mousePointerMoved = false;
mousePointerTimestamp = 0;
@@ -141,6 +143,7 @@ static const float QUICK_TAP_TIME_INTERVAL = 0.2;
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.
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];
if (!self->firstTouchMoved) {
self->latestMousePointerLocation = currentLocation;
self->firstTouchMoved = true;
}
if (self->latestMousePointerLocation.x != currentLocation.x ||
self->latestMousePointerLocation.y != currentLocation.y)
{
int deltaX = (currentLocation.x - self->latestMousePointerLocation.x) * (REFERENCE_WIDTH / self->streamViewBounds.size.width) * self->currentSettings.mousePointerVelocityFactor.floatValue;
int deltaY = (currentLocation.y - self->latestMousePointerLocation.y) * (REFERENCE_HEIGHT / self->streamViewBounds.size.height) * self->currentSettings.mousePointerVelocityFactor.floatValue;
int deltaX = (currentLocation.x - self->latestMousePointerLocation.x) * 1.35 * self->currentSettings.mousePointerVelocityFactor.floatValue;
int deltaY = (currentLocation.y - self->latestMousePointerLocation.y) * 1.35 * self->currentSettings.mousePointerVelocityFactor.floatValue;
if (deltaX != 0 || deltaY != 0) {
LiSendMouseMoveEvent(deltaX, deltaY);