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

Unified Diff: remoting/client/ios/client_gestures.mm

Issue 2869723007: [CRD iOS] Viewport fling animation (Closed)
Patch Set: 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
Index: remoting/client/ios/client_gestures.mm
diff --git a/remoting/client/ios/client_gestures.mm b/remoting/client/ios/client_gestures.mm
index f67beac120a2cc9807ceb13a42f3bd796d5dc2e5..5c912020a10d8cce4312fdfb1b3caa074c36a287 100644
--- a/remoting/client/ios/client_gestures.mm
+++ b/remoting/client/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) {
Yuwei 2017/05/10 06:53:03 Removed the |numberOfTouches| check since it seems
CGPoint translation = [sender translationInView:_view];
_client.gestureInterpreter->Pan(translation.x, translation.y);
@@ -228,6 +232,15 @@
// }
}
+// 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];
+ _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 +345,14 @@
}
}
+ if (gestureRecognizer == _flingRecognizer ||
+ (gestureRecognizer == _panRecognizer)) {
+ if (otherGestureRecognizer == _flingRecognizer ||
+ otherGestureRecognizer == _panRecognizer) {
+ return YES;
+ }
+ }
+
if (gestureRecognizer == _longPressRecognizer ||
gestureRecognizer == _panRecognizer) {
if (otherGestureRecognizer == _longPressRecognizer ||

Powered by Google App Engine
This is Rietveld 408576698