Shrink and deadzone the edge swipe region for touchscreen mode

This commit is contained in:
Cameron Gutman
2020-11-01 14:28:13 -06:00
parent 8ffee9e10f
commit 8d127decb6
+5 -2
View File
@@ -255,7 +255,7 @@ static float L3_Y;
} }
- (void) setupEdgeDetection { - (void) setupEdgeDetection {
_edge.frame = CGRectMake(0, 0, _view.frame.size.width * EDGE_WIDTH, _view.frame.size.height); _edge.frame = CGRectMake(0, 0, 5, _view.frame.size.height);
[_view.layer addSublayer:_edge]; [_view.layer addSublayer:_edge];
} }
@@ -650,6 +650,8 @@ static float L3_Y;
buttonTouch = true; buttonTouch = true;
} else if (touch == _r3Touch) { } else if (touch == _r3Touch) {
buttonTouch = true; buttonTouch = true;
} else if (touch == _edgeTouch) {
buttonTouch = true;
} }
if ([_deadTouches containsObject:touch]) { if ([_deadTouches containsObject:touch]) {
updated = true; updated = true;
@@ -658,7 +660,7 @@ static float L3_Y;
if (updated) { if (updated) {
[_controllerSupport updateFinished:_controller]; [_controllerSupport updateFinished:_controller];
} }
return updated || buttonTouch; return updated || buttonTouch;
} }
- (BOOL)handleTouchDownEvent:touches { - (BOOL)handleTouchDownEvent:touches {
@@ -771,6 +773,7 @@ static float L3_Y;
stickTouch = true; stickTouch = true;
} else if ([_edge.presentationLayer hitTest:touchLocation]) { } else if ([_edge.presentationLayer hitTest:touchLocation]) {
_edgeTouch = touch; _edgeTouch = touch;
updated = true;
} }
if (!updated && !stickTouch && [self isInDeadZone:touch]) { if (!updated && !stickTouch && [self isInDeadZone:touch]) {
[_deadTouches addObject:touch]; [_deadTouches addObject:touch];