|
|
@@ -484,8 +484,9 @@ extern int SDL_AppleTVRemoteOpenedAsJoystick;
|
|
|
{
|
|
|
CGFloat scale = sender.scale;
|
|
|
UIGestureRecognizerState state = sender.state;
|
|
|
+ bool pinchHasTwoPoints = sender.numberOfTouches == 2;
|
|
|
CGPoint point1 = [sender locationOfTouch:0 inView:self];
|
|
|
- CGPoint point2 = [sender locationOfTouch:1 inView:self];
|
|
|
+ CGPoint point2 = pinchHasTwoPoints ? [sender locationOfTouch:1 inView:self] : point1;
|
|
|
CGFloat focus_x = (point1.x + point2.x)/2;
|
|
|
CGFloat focus_y = (point1.y + point2.y)/2;
|
|
|
CGFloat span_x = SDL_fabs(point1.x - point2.x);
|
|
|
@@ -504,7 +505,7 @@ extern int SDL_AppleTVRemoteOpenedAsJoystick;
|
|
|
break;
|
|
|
|
|
|
case UIGestureRecognizerStateChanged:
|
|
|
- if (pinch_scale > 0.0f) {
|
|
|
+ if (pinch_scale > 0.0f && pinchHasTwoPoints) {
|
|
|
SDL_SendPinch(SDL_EVENT_PINCH_UPDATE, 0, sdlwindow, scale / pinch_scale, span_x, span_y, focus_x, focus_y);
|
|
|
}
|
|
|
pinch_scale = scale;
|