Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2181)

Unified Diff: remoting/ios/client_gestures.mm

Issue 2891603002: [CRD iOS] Trackpad Input Mode (Closed)
Patch Set: Fix Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/ios/app/host_view_controller.mm ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/ios/client_gestures.mm
diff --git a/remoting/ios/client_gestures.mm b/remoting/ios/client_gestures.mm
index 94f32d1842e7a8f29d065668a07c826adc869df7..35f6b34181b9edcbec6b04437f58a963230befdc 100644
--- a/remoting/ios/client_gestures.mm
+++ b/remoting/ios/client_gestures.mm
@@ -14,6 +14,18 @@
#include "base/logging.h"
#include "remoting/client/ui/gesture_interpreter.h"
+remoting::GestureInterpreter::GestureState toGestureState(
+ UIGestureRecognizerState state) {
+ switch (state) {
+ case UIGestureRecognizerStateBegan:
+ return remoting::GestureInterpreter::GESTURE_BEGAN;
+ case UIGestureRecognizerStateChanged:
+ return remoting::GestureInterpreter::GESTURE_CHANGED;
+ default:
+ return remoting::GestureInterpreter::GESTURE_ENDED;
+ }
+}
+
@implementation ClientGestures
- (instancetype)initWithView:(UIView*)view client:(RemotingClient*)client {
@@ -125,12 +137,11 @@
// 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) {
- CGPoint pivot = [sender locationInView:_view];
- _client.gestureInterpreter->Pinch(pivot.x, pivot.y, sender.scale);
+ CGPoint pivot = [sender locationInView:_view];
+ _client.gestureInterpreter->Zoom(pivot.x, pivot.y, sender.scale,
+ toGestureState([sender state]));
- sender.scale = 1.0; // reset scale so next iteration is a relative ratio
- }
+ sender.scale = 1.0; // reset scale so next iteration is a relative ratio
}
- (IBAction)tapGestureTriggered:(UITapGestureRecognizer*)sender {
@@ -274,18 +285,8 @@
// Click-Drag mouse operation. This can occur during a Pan.
- (IBAction)longPressGestureTriggered:(UILongPressGestureRecognizer*)sender {
CGPoint touchPoint = [sender locationInView:_view];
- remoting::GestureInterpreter::GestureState state;
- switch ([sender state]) {
- case UIGestureRecognizerStateBegan:
- state = remoting::GestureInterpreter::GESTURE_BEGAN;
- break;
- case UIGestureRecognizerStateChanged:
- state = remoting::GestureInterpreter::GESTURE_CHANGED;
- break;
- default:
- state = remoting::GestureInterpreter::GESTURE_ENDED;
- }
- _client.gestureInterpreter->LongPress(touchPoint.x, touchPoint.y, state);
+ _client.gestureInterpreter->Drag(touchPoint.x, touchPoint.y,
+ toGestureState([sender state]));
// LOG_TRACE(INFO) << "longPressGestureTriggered";
// if ([sender state] == UIGestureRecognizerStateBegan) {
« no previous file with comments | « remoting/ios/app/host_view_controller.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698