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

Unified Diff: remoting/ios/client_gestures.mm

Issue 2882653004: [CRD iOS] Injecting scroll events w/ fling animation (Closed)
Patch Set: Rebase 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') | 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 11a8bc3c0d7797f98ee7cc50f61d33f085006cea..94f32d1842e7a8f29d065668a07c826adc869df7 100644
--- a/remoting/ios/client_gestures.mm
+++ b/remoting/ios/client_gestures.mm
@@ -44,6 +44,14 @@
_flingRecognizer.delegate = self;
[view addGestureRecognizer:_flingRecognizer];
+ _scrollRecognizer = [[UIPanGestureRecognizer alloc]
+ initWithTarget:self
+ action:@selector(scrollGestureTriggered:)];
+ _scrollRecognizer.minimumNumberOfTouches = 2;
+ _scrollRecognizer.maximumNumberOfTouches = 2;
+ _scrollRecognizer.delegate = self;
+ [view addGestureRecognizer:_scrollRecognizer];
+
_threeFingerPanRecognizer = [[UIPanGestureRecognizer alloc]
initWithTarget:self
action:@selector(threeFingerPanGestureTriggered:)];
@@ -87,6 +95,7 @@
[_panRecognizer requireGestureRecognizerToFail:_singleTapRecognizer];
[_threeFingerPanRecognizer
requireGestureRecognizerToFail:_threeFingerTapRecognizer];
+ [_panRecognizer requireGestureRecognizerToFail:_scrollRecognizer];
_edgeGesture = [[UIScreenEdgePanGestureRecognizer alloc]
initWithTarget:self
@@ -246,6 +255,22 @@
}
}
+- (IBAction)scrollGestureTriggered:(UIPanGestureRecognizer*)sender {
+ if ([sender state] == UIGestureRecognizerStateEnded) {
+ CGPoint velocity = [sender velocityInView:_view];
+ _client.gestureInterpreter->ScrollWithVelocity(velocity.x, velocity.y);
+ return;
+ }
+
+ CGPoint scrollPoint = [sender locationInView:_view];
+ CGPoint translation = [sender translationInView:_view];
+ _client.gestureInterpreter->Scroll(scrollPoint.x, scrollPoint.y,
+ translation.x, translation.y);
+
+ // Reset translation so next iteration is relative
+ [sender setTranslation:CGPointZero inView:_view];
+}
+
// Click-Drag mouse operation. This can occur during a Pan.
- (IBAction)longPressGestureTriggered:(UILongPressGestureRecognizer*)sender {
CGPoint touchPoint = [sender locationInView:_view];
« no previous file with comments | « remoting/ios/client_gestures.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698