mirror of
https://github.com/moonlight-stream/moonlight-ios.git
synced 2026-02-16 10:31:02 +00:00
fixed multitouch issue with on-screen controls
This commit is contained in:
@@ -17,9 +17,9 @@ typedef NS_ENUM(NSInteger, OnScreenControlsLevel) {
|
||||
};
|
||||
|
||||
- (id) initWithView:(UIView*)view;
|
||||
- (BOOL) handleTouchDownEvent:(UIEvent*)event;
|
||||
- (BOOL) handleTouchUpEvent:(UIEvent*) event;
|
||||
- (BOOL) handleTouchMovedEvent:(UIEvent*)event;
|
||||
- (BOOL) handleTouchDownEvent:(NSSet*)touches;
|
||||
- (BOOL) handleTouchUpEvent:(NSSet*)touches;
|
||||
- (BOOL) handleTouchMovedEvent:(NSSet*)touches;
|
||||
- (void) setLevel:(OnScreenControlsLevel)level;
|
||||
|
||||
@end
|
||||
|
||||
@@ -313,7 +313,7 @@ static float L2_Y;
|
||||
[_rightStick removeFromSuperlayer];
|
||||
}
|
||||
|
||||
- (BOOL) handleTouchMovedEvent:(UIEvent*)event {
|
||||
- (BOOL) handleTouchMovedEvent:touches {
|
||||
BOOL shouldSendPacket = false;
|
||||
BOOL buttonTouch = false;
|
||||
float rsMaxX = RS_CENTER_X + STICK_OUTER_SIZE / 2;
|
||||
@@ -325,7 +325,7 @@ static float L2_Y;
|
||||
float lsMinX = LS_CENTER_X - STICK_OUTER_SIZE / 2;
|
||||
float lsMinY = LS_CENTER_Y - STICK_OUTER_SIZE / 2;
|
||||
|
||||
for (UITouch* touch in [event allTouches]) {
|
||||
for (UITouch* touch in touches) {
|
||||
CGPoint touchLocation = [touch locationInView:_view];
|
||||
float xLoc = touchLocation.x;
|
||||
float yLoc = touchLocation.y;
|
||||
@@ -402,9 +402,9 @@ static float L2_Y;
|
||||
return shouldSendPacket || buttonTouch;
|
||||
}
|
||||
|
||||
- (BOOL)handleTouchDownEvent:(UIEvent*)event {
|
||||
- (BOOL)handleTouchDownEvent:touches {
|
||||
BOOL shouldSendPacket = false;
|
||||
for (UITouch* touch in [event allTouches]) {
|
||||
for (UITouch* touch in touches) {
|
||||
CGPoint touchLocation = [touch locationInView:_view];
|
||||
|
||||
if ([_aButton.presentationLayer hitTest:touchLocation]) {
|
||||
@@ -478,9 +478,9 @@ static float L2_Y;
|
||||
return shouldSendPacket;
|
||||
}
|
||||
|
||||
- (BOOL)handleTouchUpEvent:(UIEvent*)event {
|
||||
- (BOOL)handleTouchUpEvent:touches {
|
||||
BOOL shouldSendPacket = false;
|
||||
for (UITouch* touch in [event allTouches]) {
|
||||
for (UITouch* touch in touches) {
|
||||
if (touch == _aTouch) {
|
||||
UPDATE_BUTTON(A_FLAG, 0);
|
||||
_aTouch = nil;
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
|
||||
NSLog(@"Touch down");
|
||||
if (![onScreenControls handleTouchDownEvent:event]) {
|
||||
if (![onScreenControls handleTouchDownEvent:touches]) {
|
||||
UITouch *touch = [[event allTouches] anyObject];
|
||||
touchLocation = [touch locationInView:self];
|
||||
touchMoved = false;
|
||||
@@ -35,7 +35,7 @@
|
||||
}
|
||||
|
||||
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
|
||||
if (![onScreenControls handleTouchMovedEvent:event]) {
|
||||
if (![onScreenControls handleTouchMovedEvent:touches]) {
|
||||
if ([[event allTouches] count] == 1) {
|
||||
UITouch *touch = [[event allTouches] anyObject];
|
||||
CGPoint currentLocation = [touch locationInView:self];
|
||||
@@ -66,7 +66,7 @@
|
||||
|
||||
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
|
||||
NSLog(@"Touch up");
|
||||
if (![onScreenControls handleTouchUpEvent:event]) {
|
||||
if (![onScreenControls handleTouchUpEvent:touches]) {
|
||||
if (!touchMoved) {
|
||||
if ([[event allTouches] count] == 2) {
|
||||
NSLog(@"Sending right mouse button press");
|
||||
|
||||
Reference in New Issue
Block a user