From 2e7ffc2c5247a045cd38c7af0ce4bd1beaed0e32 Mon Sep 17 00:00:00 2001 From: ZWM <> Date: Thu, 9 May 2024 23:00:19 +0800 Subject: [PATCH] improve custom edge swipe recognizer on detecting start point. Swipe half screen from left edge to quit session now works on ipad mini5. --- .../ViewControllers/CustomEdgeSwipeGestureRecognizer.m | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Limelight/ViewControllers/CustomEdgeSwipeGestureRecognizer.m b/Limelight/ViewControllers/CustomEdgeSwipeGestureRecognizer.m index e8ec9d9b..6813c223 100644 --- a/Limelight/ViewControllers/CustomEdgeSwipeGestureRecognizer.m +++ b/Limelight/ViewControllers/CustomEdgeSwipeGestureRecognizer.m @@ -36,12 +36,15 @@ [super touchesMoved:touches withEvent:event]; UITouch *touch = [touches anyObject]; CGPoint gestureEndPoint = [touch locationInView:self.view]; - CGFloat nomarlizedgestureEndPointXDelta = (gestureEndPoint.x-_startPoint.x)/screenWidthInPoints; + CGFloat nomarlizedGestureEndPointX = gestureEndPoint.x/screenWidthInPoints; + CGFloat nomarlizedStartPointX = _startPoint.x/screenWidthInPoints; // CGFloat nomarlizedgestureEndPointYDelta = (gestureEndPoint.y-_startPoint.y)/screenHeightInPoints; // Log(LOG_I, @"current point x: %f", nomarlizedgestureEndPointXDelta); - + NSLog(@"in CUSTOM swipe REC"); + NSLog(@"startpointX %f", _startPoint.x); + NSLog(@"NorXDelta %f", nomarlizedGestureEndPointX); _nomarlizedswipeThreshold = 0.5; // You need swipe half of screen width from left edge to trigger this Recognizer - if (_startPoint.x == 0.0 && nomarlizedgestureEndPointXDelta > _nomarlizedswipeThreshold) { + if (nomarlizedStartPointX <= 0.025 && nomarlizedGestureEndPointX > _nomarlizedswipeThreshold) { // Detected a swipe from the left edge that exceeds _nomarlizedswipeThreshold if (self.state == UIGestureRecognizerStatePossible) { self.state = UIGestureRecognizerStateBegan;