tweak edge slide & touchHandler

This commit is contained in:
TrueZhuanjia
2025-07-16 13:55:19 +08:00
parent d1ecc894b3
commit 5e40c9f9ad
5 changed files with 13 additions and 11 deletions
+1 -1
View File
@@ -47,7 +47,7 @@
self->streamView = view;
// upper screen check
EDGE_TOLERANCE = 15.0;
EDGE_TOLERANCE = 10.0;
slideGestureVerticalThreshold = CGRectGetHeight([[UIScreen mainScreen] bounds]) * 0.4;
screenWidthWithThreshold = CGRectGetWidth([[UIScreen mainScreen] bounds]) - EDGE_TOLERANCE;
self->touchPointSpawnedAtUpperScreenEdge = false;
+4 -3
View File
@@ -86,7 +86,7 @@
self->pointerObjDict = [NSMutableDictionary dictionary];
EDGE_TOLERANCE = 15.0;
EDGE_TOLERANCE = 10.0;
slideGestureVerticalThreshold = CGRectGetHeight([[UIScreen mainScreen] bounds]) * 0.4;
screenWidthWithThreshold = CGRectGetWidth([[UIScreen mainScreen] bounds]) - EDGE_TOLERANCE;
@@ -190,7 +190,7 @@
- (void)sendTouchEvent:(UITouch*)touch withTouchtype:(uint8_t)touchType{
if(touchPointSpawnedAtUpperScreenEdge) return; // we're done here. this touch event will not be sent to the remote PC. and this must be checked after coord selector finishes populating new relative coords, or the app will crash!
if(touchPointSpawnedAtUpperScreenEdge && touchType != LI_TOUCH_EVENT_UP) return; // we're done here. this touch event will not be sent to the remote PC. and this must be checked after coord selector finishes populating new relative coords, or the app will crash
CGPoint targetCoords;
//NSLog(@"selecting coords: %d", touch.phase == UITouchPhaseMoved);
@@ -264,7 +264,8 @@
[self removePointerId:touch]; //then remove pointerId
if(self->activateCoordSelector) [self removePointerObjFromDict:touch];
}
if(self->touchPointSpawnedAtUpperScreenEdge && [[event allTouches] count] == [touches count]) self->touchPointSpawnedAtUpperScreenEdge = false; //bugbugbugbugbugbugbugbug
//if(self->touchPointSpawnedAtUpperScreenEdge && [[event allTouches] count] == [touches count])
self->touchPointSpawnedAtUpperScreenEdge = false;
});
else{
for (UITouch* touch in touches){
+4 -4
View File
@@ -85,7 +85,7 @@
self->pointerObjDict = [NSMutableDictionary dictionary];
EDGE_TOLERANCE = 15.0;
EDGE_TOLERANCE = 10.0;
slideGestureVerticalThreshold = CGRectGetHeight([[UIScreen mainScreen] bounds]) * 0.4;
screenWidthWithThreshold = CGRectGetWidth([[UIScreen mainScreen] bounds]) - EDGE_TOLERANCE;
@@ -189,8 +189,8 @@
- (void)sendTouchEvent:(UITouch*)touch withTouchtype:(uint8_t)touchType{
if(touchPointSpawnedAtUpperScreenEdge) return; // we're done here. this touch event will not be sent to the remote PC. and this must be checked after coord selector finishes populating new relative coords, or the app will crash!
if(touchPointSpawnedAtUpperScreenEdge && touchType != LI_TOUCH_EVENT_UP) return; // we're done here. this touch event will not be sent to the remote PC. and this must be checked after coord selector finishes populating new relative coords, or the app will crash
CGPoint targetCoords;
//NSLog(@"selecting coords: %d", touch.phase == UITouchPhaseMoved);
// NSLog(@"excluded count: %d", (uint32_t)[excludedPointerIds count]);
@@ -253,7 +253,7 @@
[self removePointerId:touch]; //then remove pointerId
if(self->activateCoordSelector) [self removePointerObjFromDict:touch];
}
if(self->touchPointSpawnedAtUpperScreenEdge && [[event allTouches] count] == [touches count]) self->touchPointSpawnedAtUpperScreenEdge = false;
self->touchPointSpawnedAtUpperScreenEdge = false;
});
else{
for (UITouch* touch in touches){
+3 -2
View File
@@ -63,7 +63,7 @@ static const float QUICK_TAP_TIME_INTERVAL = 0.2;
mousePointerTimestamp = 0;
// upper screen check
EDGE_TOLERANCE = 15.0;
EDGE_TOLERANCE = 10.0;
slideGestureVerticalThreshold = CGRectGetHeight([[UIScreen mainScreen] bounds]) * 0.4;
screenWidthWithThreshold = CGRectGetWidth([[UIScreen mainScreen] bounds]) - EDGE_TOLERANCE;
self->touchPointSpawnedAtUpperScreenEdge = false;
@@ -238,8 +238,9 @@ static const float QUICK_TAP_TIME_INTERVAL = 0.2;
touchLockedForMouseMove = nil;
mousePointerMoved = false; // need to reset this anyway
[self resetAllPressedFlagsForOnScreenWidgetViews]; // reset all pressed flag for on-screen widget views after all fingers lifted from screen.
touchPointSpawnedAtUpperScreenEdge = false;
}
touchPointSpawnedAtUpperScreenEdge = false;
}
@@ -20,7 +20,7 @@ static CGFloat screenWidthInPoints;
self = [super initWithTarget:target action:action];
screenWidthInPoints = CGRectGetWidth([UIApplication.sharedApplication.windows.firstObject.screen bounds]); // Get the screen's bounds (in points)
_immediateTriggering = false;
_EDGE_TOLERANCE = 15.0f;
_EDGE_TOLERANCE = 10.0f;
return self;
}