Chromium Code Reviews| Index: remoting/client/ios/client_gestures.mm |
| diff --git a/remoting/client/ios/client_gestures.mm b/remoting/client/ios/client_gestures.mm |
| index 047e8ea8ac68dfa6a57972cd04dcddd7ea3c51fd..f667c68dbf84ea29364e58a910d4a3b3b16eb91e 100644 |
| --- a/remoting/client/ios/client_gestures.mm |
| +++ b/remoting/client/ios/client_gestures.mm |
| @@ -10,7 +10,11 @@ |
| @implementation ClientGestures |
| -- (id)initWithView:(UIView*)view { |
| +- (instancetype)initWithView:(UIView*)view |
| + viewport:(remoting::DesktopViewport*)vp { |
| + _view = view; |
| + _viewport = vp; |
| + |
| _inputScheme = HostInputSchemeTouch; |
| _longPressRecognizer = [[UILongPressGestureRecognizer alloc] |
| @@ -99,11 +103,12 @@ |
| // Resize the view of the desktop - Zoom in/out. This can occur during a Pan. |
| - (IBAction)pinchGestureTriggered:(UIPinchGestureRecognizer*)sender { |
| // LOG_TRACE(INFO) << "pinchGestureTriggered"; |
| - // if ([sender state] == UIGestureRecognizerStateChanged) { |
| - // [self applySceneChange:CGPointMake(0.0, 0.0) scaleBy:sender.scale]; |
| - // |
| - // sender.scale = 1.0; // reset scale so next iteration is a relative ratio |
| - // } |
| + if ([sender state] == UIGestureRecognizerStateChanged) { |
| + CGPoint pivot = [sender locationInView:_view]; |
|
Yuwei
2017/05/03 05:52:35
I'm planning on creating a new C++ class to be sha
nicholss
2017/05/03 15:33:50
Note this class is copy/paste from the original ba
|
| + _viewport->ScaleDesktop(pivot.x, pivot.y, sender.scale); |
| + |
| + sender.scale = 1.0; // reset scale so next iteration is a relative ratio |
| + } |
| } |
| - (IBAction)tapGestureTriggered:(UITapGestureRecognizer*)sender { |
| @@ -121,7 +126,19 @@ |
| // Change position of scene. This can occur during a pinch or long press. |
| // Or perform a Mouse Wheel Scroll. |
| +// TODO(yuweih): The comment above doesn't seem right. Non-panning gestures |
| +// should be moved out of this method. |
| - (IBAction)panGestureTriggered:(UIPanGestureRecognizer*)sender { |
| + // TODO(yuweih): Need deceleration animation, probably in another class. |
| + if ([sender state] == UIGestureRecognizerStateChanged && |
| + [sender numberOfTouches] == 1) { |
| + CGPoint translation = [sender translationInView:_view]; |
| + _viewport->MoveDesktop(translation.x, translation.y); |
| + |
| + // Reset translation so next iteration is relative |
| + [sender setTranslation:CGPointZero inView:_view]; |
| + } |
| + |
| // LOG_TRACE(INFO) << "panGestureTriggered"; |
| // CGPoint translation = [sender translationInView:self.view]; |
| // // If we start with 2 touches, and the pinch gesture is not in progress |