improve custom edge swipe recognizer on detecting start point. Swipe half screen from left edge to quit session now works on ipad mini5.
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user