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

Unified Diff: remoting/ios/client_gestures.mm

Issue 2869723007: [CRD iOS] Viewport fling animation (Closed)
Patch Set: Merge branch 'master' into feat-fling-animation 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/client_gestures.h ('k') | remoting/ios/display/gl_display_handler.h » ('j') | 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 f6e0be754de3c10da5a6fcebf04cac974a9e631f..20e4701c10b290189b245f312d3c290eb71c2aff 100644
--- a/remoting/ios/client_gestures.mm
+++ b/remoting/ios/client_gestures.mm
@@ -33,6 +33,14 @@
_panRecognizer.delegate = self;
[view addGestureRecognizer:_panRecognizer];
+ _flingRecognizer = [[UIPanGestureRecognizer alloc]
+ initWithTarget:self
+ action:@selector(flingGestureTriggered:)];
+ _flingRecognizer.minimumNumberOfTouches = 1;
+ _flingRecognizer.maximumNumberOfTouches = 1;
+ _flingRecognizer.delegate = self;
+ [view addGestureRecognizer:_flingRecognizer];
+
_threeFingerPanRecognizer = [[UIPanGestureRecognizer alloc]
initWithTarget:self
action:@selector(threeFingerPanGestureTriggered:)];
@@ -120,12 +128,8 @@
// 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) {
+ if ([sender state] == UIGestureRecognizerStateChanged) {
CGPoint translation = [sender translationInView:_view];
_client.gestureInterpreter->Pan(translation.x, translation.y);
@@ -228,6 +232,17 @@
// }
}
+// Do fling on the viewport. This will happen at the end of the one-finger
+// panning.
+- (IBAction)flingGestureTriggered:(UIPanGestureRecognizer*)sender {
+ if ([sender state] == UIGestureRecognizerStateEnded) {
+ CGPoint velocity = [sender velocityInView:_view];
+ if (velocity.x != 0 || velocity.y != 0) {
+ _client.gestureInterpreter->OneFingerFling(velocity.x, velocity.y);
+ }
+ }
+}
+
// Click-Drag mouse operation. This can occur during a Pan.
- (IBAction)longPressGestureTriggered:(UILongPressGestureRecognizer*)sender {
CGPoint touchPoint = [sender locationInView:_view];
@@ -332,6 +347,14 @@
}
}
+ if (gestureRecognizer == _flingRecognizer ||
+ (gestureRecognizer == _panRecognizer)) {
+ if (otherGestureRecognizer == _flingRecognizer ||
+ otherGestureRecognizer == _panRecognizer) {
+ return YES;
+ }
+ }
+
if (gestureRecognizer == _longPressRecognizer ||
gestureRecognizer == _panRecognizer) {
if (otherGestureRecognizer == _longPressRecognizer ||
« no previous file with comments | « remoting/ios/client_gestures.h ('k') | remoting/ios/display/gl_display_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698