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:
1 parent
b98ccb2a30
commit
2e7ffc2c52
1 file changed
+6
-3
@@ -36,12 +36,15 @@
|
|||||||
[super touchesMoved:touches withEvent:event];
|
[super touchesMoved:touches withEvent:event];
|
||||||
UITouch *touch = [touches anyObject];
|
UITouch *touch = [touches anyObject];
|
||||||
CGPoint gestureEndPoint = [touch locationInView:self.view];
|
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;
|
// CGFloat nomarlizedgestureEndPointYDelta = (gestureEndPoint.y-_startPoint.y)/screenHeightInPoints;
|
||||||
// Log(LOG_I, @"current point x: %f", nomarlizedgestureEndPointXDelta);
|
// 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
|
_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
|
// Detected a swipe from the left edge that exceeds _nomarlizedswipeThreshold
|
||||||
if (self.state == UIGestureRecognizerStatePossible) {
|
if (self.state == UIGestureRecognizerStatePossible) {
|
||||||
self.state = UIGestureRecognizerStateBegan;
|
self.state = UIGestureRecognizerStateBegan;
|
||||||
|
|||||||
Reference in new issue
Block a user