Build 31 touches spawned at the upper 40% screen edge (left or right) will not be sent to the remote PC

This commit is contained in:
True Zhuanjia
2024-08-20 23:16:26 +08:00
parent ba4af74a9d
commit db75cac9bc
3 changed files with 31 additions and 13 deletions
@@ -16,7 +16,7 @@
@property (nonatomic, assign) UIRectEdge edges; // Specify the edge(s) you want to recognize the swipe gesture on
@property (nonatomic, assign) CGFloat normalizedThresholdDistance; // Distance from the edge to start recognizing the gesture
@property (nonatomic, assign) bool immediateTriggering;
@property (nonatomic, assign) CGFloat edgeTolerancePoints;
@property (nonatomic, assign) CGFloat EDGE_TOLERANCE;
@end
#endif /* CustomEdgeSwipeGestureRecognizer_h */
@@ -20,7 +20,7 @@ static CGFloat screenWidthInPoints;
self = [super initWithTarget:target action:action];
screenWidthInPoints = CGRectGetWidth([[UIScreen mainScreen] bounds]); // Get the screen's bounds (in points)
_immediateTriggering = false;
_edgeTolerancePoints = 50.0f;
_EDGE_TOLERANCE = 15.0f;
return self;
}
@@ -32,13 +32,13 @@ static CGFloat screenWidthInPoints;
if(_immediateTriggering){
if(self.edges & UIRectEdgeLeft){
if(startPointX < _edgeTolerancePoints){
if(startPointX < _EDGE_TOLERANCE){
self.state = UIGestureRecognizerStateEnded;
}
// NSLog(@"startPointX %f , normalizedGestureDeltaX %f", startPointX, normalizedGestureDistance);
}
if(self.edges & UIRectEdgeRight){
if(startPointX > screenWidthInPoints - _edgeTolerancePoints){
if(startPointX > screenWidthInPoints - _EDGE_TOLERANCE){
self.state = UIGestureRecognizerStateEnded;
}
// NSLog(@"startPointX %f , normalizedGestureDeltaX %f", startPointX, normalizedGestureDistance);
@@ -55,13 +55,13 @@ static CGFloat screenWidthInPoints;
CGFloat normalizedGestureDistance = fabs(_endPointX - startPointX)/screenWidthInPoints;
if(self.edges & UIRectEdgeLeft){
if(startPointX < _edgeTolerancePoints && normalizedGestureDistance > _normalizedThresholdDistance){
if(startPointX < _EDGE_TOLERANCE && normalizedGestureDistance > _normalizedThresholdDistance){
self.state = UIGestureRecognizerStateEnded;
}
// NSLog(@"startPointX %f , normalizedGestureDeltaX %f", startPointX, normalizedGestureDistance);
}
if(self.edges & UIRectEdgeRight){
if((startPointX > (screenWidthInPoints - _edgeTolerancePoints)) && normalizedGestureDistance > _normalizedThresholdDistance){
if((startPointX > (screenWidthInPoints - _EDGE_TOLERANCE)) && normalizedGestureDistance > _normalizedThresholdDistance){
self.state = UIGestureRecognizerStateEnded;
}
// NSLog(@"startPointX %f , normalizedGestureDeltaX %f", startPointX, normalizedGestureDistance);