From 17b6f9f7a3912c40bee5bc3a3585b1969ac7fcb4 Mon Sep 17 00:00:00 2001 From: Xiong Shimin Date: Mon, 1 May 2017 17:58:35 +0800 Subject: [PATCH] Fix: in some extreme case on-screen touch controls get stuck on iOS --- ios/ViewController.mm | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/ios/ViewController.mm b/ios/ViewController.mm index b1bb24a6a9..0be72eecb7 100644 --- a/ios/ViewController.mm +++ b/ios/ViewController.mm @@ -344,6 +344,17 @@ static GraphicsContext *graphicsContext; } } +- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event +{ + for(UITouch* touch in touches) + { + CGPoint point = [touch locationInView:self.view]; + NSDictionary* dict = [self touchDictBy:touch]; + [self touchX:point.x y:point.y code:2 pointerId:[[dict objectForKey:@"index"] intValue]]; + [self.touches removeObject:dict]; + } +} + - (void)bindDefaultFBO { [(GLKView*)self.view bindDrawable];