diff options
author | Tor Lillqvist <tml@iki.fi> | 2013-04-18 22:29:50 +0300 |
---|---|---|
committer | Tor Lillqvist <tml@iki.fi> | 2013-04-19 00:18:33 +0300 |
commit | 1e7bf8de3b3bc4ac1d65d8b101d7ccedab24fcad (patch) | |
tree | 39f7de356bbb3c9c7bf68aba17855760d9f628e3 /ios | |
parent | 7711a60a64cc02e2a733b73be21525370d3840b2 (diff) |
Add pan gesture handling
I get exactly the same kind of artefacts as in the Android app, which
I guess is good as it is at least consistent, as the implementation at
the LO layer is identical...
Change-Id: Icf0690fd2c48a133cb66de2ab7977b7088d2199e
Diffstat (limited to 'ios')
-rw-r--r-- | ios/experimental/LibreOffice/LibreOffice/AppDelegate.m | 2 | ||||
-rw-r--r-- | ios/experimental/LibreOffice/LibreOffice/View.h | 3 | ||||
-rw-r--r-- | ios/experimental/LibreOffice/LibreOffice/View.m | 12 |
3 files changed, 15 insertions, 2 deletions
diff --git a/ios/experimental/LibreOffice/LibreOffice/AppDelegate.m b/ios/experimental/LibreOffice/LibreOffice/AppDelegate.m index 9a9314522533..dd5ac41faea1 100644 --- a/ios/experimental/LibreOffice/LibreOffice/AppDelegate.m +++ b/ios/experimental/LibreOffice/LibreOffice/AppDelegate.m @@ -59,8 +59,10 @@ static View *theView; self.view->textView.delegate = self; UITapGestureRecognizer *tapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self.view action:@selector(tapGesture:)]; + UIPanGestureRecognizer *panRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self.view action:@selector(panGesture:)]; [self.window addGestureRecognizer: tapRecognizer]; + [self.window addGestureRecognizer: panRecognizer]; NSLog(@"statusBarOrientation: %d", [[UIApplication sharedApplication] statusBarOrientation]); diff --git a/ios/experimental/LibreOffice/LibreOffice/View.h b/ios/experimental/LibreOffice/LibreOffice/View.h index b0e8394809b2..4abe2baa1e58 100644 --- a/ios/experimental/LibreOffice/LibreOffice/View.h +++ b/ios/experimental/LibreOffice/LibreOffice/View.h @@ -15,7 +15,8 @@ UITextView* textView; } - (void)drawRect:(CGRect)rect; -- (void)tapGesture:(UIGestureRecognizer *)gestureRecognizer; +- (void)tapGesture:(UITapGestureRecognizer *)gestureRecognizer; +- (void)panGesture:(UIPanGestureRecognizer *)gestureRecognizer; @end diff --git a/ios/experimental/LibreOffice/LibreOffice/View.m b/ios/experimental/LibreOffice/LibreOffice/View.m index 56e4e0ea0451..ed1abc695258 100644 --- a/ios/experimental/LibreOffice/LibreOffice/View.m +++ b/ios/experimental/LibreOffice/LibreOffice/View.m @@ -46,7 +46,7 @@ // NSLog(@"drawRect: lo_render_windows took %f s", [[NSDate date] timeIntervalSinceDate: startDate]); } -- (void) tapGesture:(UIGestureRecognizer *)gestureRecognizer +- (void)tapGesture:(UITapGestureRecognizer *)gestureRecognizer { if ([gestureRecognizer state] == UIGestureRecognizerStateEnded) { CGPoint location = [gestureRecognizer locationInView: self]; @@ -57,6 +57,16 @@ NSLog(@"tapGesture: %@", gestureRecognizer); } +- (void)panGesture:(UIPanGestureRecognizer *)gestureRecognizer +{ + if ([gestureRecognizer state] == UIGestureRecognizerStateEnded) { + CGPoint translation = [gestureRecognizer translationInView: self]; + NSLog(@"panGesture: pan: (%d,%d)", (int)translation.x, (int)translation.y); + lo_pan(translation.x, translation.y); + } else + NSLog(@"panGesture: %@", gestureRecognizer); +} + @end // vim:set shiftwidth=4 softtabstop=4 expandtab: |