Skip to content

Commit

Permalink
[ios] adapt ios touch events for the new pinch strategy (thanks Memphiz)
Browse files Browse the repository at this point in the history
  • Loading branch information
Montellese committed Aug 10, 2012
1 parent 666e54d commit 76f8c0c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 15 deletions.
4 changes: 0 additions & 4 deletions xbmc/osx/ios/XBMCController.h
Expand Up @@ -38,8 +38,6 @@
/* Touch handling */
CGSize screensize;
CGPoint lastGesturePoint;
CGFloat lastPinchScale;
CGFloat currentPinchScale;
CGFloat screenScale;
bool touchBeginSignaled;
int m_screenIdx;
Expand All @@ -50,8 +48,6 @@
}
@property (readonly, nonatomic, getter=isAnimating) BOOL animating;
@property CGPoint lastGesturePoint;
@property CGFloat lastPinchScale;
@property CGFloat currentPinchScale;
@property CGFloat screenScale;
@property bool touchBeginSignaled;
@property int m_screenIdx;
Expand Down
20 changes: 9 additions & 11 deletions xbmc/osx/ios/XBMCController.mm
Expand Up @@ -68,8 +68,6 @@ -(void) terminateWithSuccess;
@implementation XBMCController
@synthesize animating;
@synthesize lastGesturePoint;
@synthesize lastPinchScale;
@synthesize currentPinchScale;
@synthesize screenScale;
@synthesize lastEvent;
@synthesize touchBeginSignaled;
Expand Down Expand Up @@ -193,8 +191,6 @@ - (void)createGestureRecognizers
pinch.delaysTouchesBegan = YES;
[self.view addGestureRecognizer:pinch];
[pinch release];
lastPinchScale = 1.0;
currentPinchScale = lastPinchScale;
}
//--------------------------------------------------------------
- (void) activateKeyboard:(UIView *)view
Expand All @@ -214,21 +210,23 @@ -(void)handlePinch:(UIPinchGestureRecognizer*)sender
CGPoint point = [sender locationOfTouch:0 inView:m_glView];
point.x *= screenScale;
point.y *= screenScale;
currentPinchScale += [sender scale] - lastPinchScale;
lastPinchScale = [sender scale];

switch(sender.state)
{
case UIGestureRecognizerStateBegan:
break;
CApplicationMessenger::Get().SendAction(CAction(ACTION_GESTURE_BEGIN, 0, (float)point.x, (float)point.y,
0, 0), WINDOW_INVALID,false);
break;
case UIGestureRecognizerStateChanged:
CApplicationMessenger::Get().SendAction(CAction(ACTION_GESTURE_ZOOM, 0, (float)point.x, (float)point.y,
currentPinchScale, 0), WINDOW_INVALID,false);
break;
[sender scale], 0), WINDOW_INVALID,false);
break;
case UIGestureRecognizerStateEnded:
break;
CApplicationMessenger::Get().SendAction(CAction(ACTION_GESTURE_END, 0, 0, 0,
0, 0), WINDOW_INVALID,false);
break;
default:
break;
break;
}
}
}
Expand Down

0 comments on commit 76f8c0c

Please sign in to comment.