|
17 | 17 |
|
18 | 18 | #define VALIDATE_DOCUMENT(document, ...) { if (!document.isValid) { [self.commandDelegate sendPluginResult:[CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"Document is invalid."] callbackId:command.callbackId]; return __VA_ARGS__; }} |
19 | 19 |
|
20 | | -@interface PSPDFKitPlugin () <PSPDFViewControllerDelegate, PSPDFFlexibleToolbarContainerDelegate, UIGestureRecognizerDelegate> |
| 20 | +@interface PSPDFKitPlugin () <PSPDFViewControllerDelegate, PSPDFFlexibleToolbarContainerDelegate> |
21 | 21 |
|
22 | 22 | @property (nonatomic, strong) UINavigationController *navigationController; |
23 | 23 | @property (nonatomic, strong) PSPDFViewController *pdfController; |
@@ -480,13 +480,15 @@ - (void)configurePDFViewControllerWithPath:(NSString *)path options:(NSDictionar |
480 | 480 | _pdfController.document = _pdfDocument; |
481 | 481 |
|
482 | 482 | // Setup gesture recognizers. |
483 | | - UITapGestureRecognizer *tapGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapGestureRecognizerDidChangeState:)]; |
| 483 | + UITapGestureRecognizer *tapGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapGestureRecognizerDidFire:)]; |
| 484 | + tapGestureRecognizer.cancelsTouchesInView = NO; |
484 | 485 | [_pdfController.interactions.allInteractions allowSimultaneousRecognitionWithGestureRecognizer:tapGestureRecognizer]; |
485 | | - [_pdfController.view addGestureRecognizer:tapGestureRecognizer]; |
| 486 | + [_pdfController.documentViewController.view addGestureRecognizer:tapGestureRecognizer]; |
486 | 487 |
|
487 | | - UILongPressGestureRecognizer *longPressGestureRecognizer = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longPressGestureRecognizerDidChangeState:)]; |
| 488 | + UILongPressGestureRecognizer *longPressGestureRecognizer = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longPressGestureRecognizerDidFire:)]; |
| 489 | + longPressGestureRecognizer.cancelsTouchesInView = NO; |
488 | 490 | [_pdfController.interactions.allInteractions allowSimultaneousRecognitionWithGestureRecognizer:longPressGestureRecognizer]; |
489 | | - [_pdfController.view addGestureRecognizer:longPressGestureRecognizer]; |
| 491 | + [_pdfController.documentViewController.view addGestureRecognizer:longPressGestureRecognizer]; |
490 | 492 |
|
491 | 493 | // Notifications |
492 | 494 | [NSNotificationCenter.defaultCenter addObserver:self selector:@selector(annotationChangedNotification:) name:PSPDFAnnotationsAddedNotification object:nil]; |
@@ -1593,20 +1595,14 @@ - (CGRect)flexibleToolbarContainerContentRect:(PSPDFFlexibleToolbarContainer *)c |
1593 | 1595 | return container.bounds; |
1594 | 1596 | } |
1595 | 1597 |
|
1596 | | -#pragma mark - UIGestureRecognizerDelegate |
1597 | | - |
1598 | | -- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer { |
1599 | | - return [_pdfController.interactions.allAnnotationInteractions canActivateAtPoint:[gestureRecognizer locationInView:_pdfController.view] inCoordinateSpace:_pdfController.view]; |
1600 | | -} |
1601 | | - |
1602 | 1598 | #pragma mark - Gesture Recognizers |
1603 | 1599 |
|
1604 | | -- (void)tapGestureRecognizerDidChangeState:(UITapGestureRecognizer *)gestureRecognizer { |
| 1600 | +- (void)tapGestureRecognizerDidFire:(UITapGestureRecognizer *)gestureRecognizer { |
1605 | 1601 | CGPoint viewPoint = [gestureRecognizer locationInView:_pdfController.view]; |
1606 | 1602 | [self sendEventWithJSON:[NSString stringWithFormat:@"{type:'didTapOnPageView',viewPoint:[%g,%g]}", viewPoint.x, viewPoint.y]]; |
1607 | 1603 | } |
1608 | 1604 |
|
1609 | | -- (void)longPressGestureRecognizerDidChangeState:(UILongPressGestureRecognizer *)gestureRecognizer { |
| 1605 | +- (void)longPressGestureRecognizerDidFire:(UILongPressGestureRecognizer *)gestureRecognizer { |
1610 | 1606 | CGPoint viewPoint = [gestureRecognizer locationInView:_pdfController.view]; |
1611 | 1607 | [self sendEventWithJSON:[NSString stringWithFormat:@"{type:'didLongPressOnPageView',viewPoint:[%g,%g]}", viewPoint.x, viewPoint.y]]; |
1612 | 1608 | } |
|
0 commit comments