diff options
author | marinofaggiana <ios@nextcloud.com> | 2022-05-04 18:26:30 +0300 |
---|---|---|
committer | marinofaggiana <ios@nextcloud.com> | 2022-05-04 18:26:30 +0300 |
commit | cfa261604825ca07099bc45f7fec29298514e8f0 (patch) | |
tree | a3f859a325a264b8e48c909088331e3126a11bce /iOSClient | |
parent | 15ba1048c972804cfe97a9123755ff468b61a7b0 (diff) |
Recognize Simultaneously Gesturefeature/pdfview
Signed-off-by: marinofaggiana <ios@nextcloud.com>
Diffstat (limited to 'iOSClient')
-rw-r--r-- | iOSClient/Viewer/NCViewerPDF/NCViewerPDF.swift | 36 |
1 files changed, 24 insertions, 12 deletions
diff --git a/iOSClient/Viewer/NCViewerPDF/NCViewerPDF.swift b/iOSClient/Viewer/NCViewerPDF/NCViewerPDF.swift index 3e77c598f..2ffae21d9 100644 --- a/iOSClient/Viewer/NCViewerPDF/NCViewerPDF.swift +++ b/iOSClient/Viewer/NCViewerPDF/NCViewerPDF.swift @@ -25,7 +25,7 @@ import UIKit import PDFKit import EasyTipView -class NCViewerPDF: UIViewController, NCViewerPDFSearchDelegate, UIGestureRecognizerDelegate { +class NCViewerPDF: UIViewController, NCViewerPDFSearchDelegate { var metadata = tableMetadata() var imageIcon: UIImage? @@ -52,6 +52,9 @@ class NCViewerPDF: UIViewController, NCViewerPDFSearchDelegate, UIGestureRecogni private var pdfThumbnailScrollViewWidthAnchor: NSLayoutConstraint? private var pageViewWidthAnchor: NSLayoutConstraint? + private var swipePdfView: UISwipeGestureRecognizer? + private var edgePdfView: UIScreenEdgePanGestureRecognizer? + // MARK: - View Life Cycle required init?(coder aDecoder: NSCoder) { @@ -168,22 +171,24 @@ class NCViewerPDF: UIViewController, NCViewerPDFSearchDelegate, UIGestureRecogni tapPdfView.require(toFail: gesture) } - let swipePdfView = UISwipeGestureRecognizer(target: self, action: #selector(gestureClosePdfThumbnail)) - swipePdfView.direction = .right - pdfView.addGestureRecognizer(swipePdfView) + swipePdfView = UISwipeGestureRecognizer(target: self, action: #selector(gestureClosePdfThumbnail)) + if let swipePdfView = swipePdfView { + swipePdfView.direction = .right + swipePdfView.delegate = self + pdfView.addGestureRecognizer(swipePdfView) + } + + edgePdfView = UIScreenEdgePanGestureRecognizer(target: self, action: #selector(gestureOpenPdfThumbnail)) + if let edgePdfView = edgePdfView { + edgePdfView.edges = .right + edgePdfView.delegate = self + pdfView.addGestureRecognizer(edgePdfView) + } let swipePdfThumbnailScrollView = UISwipeGestureRecognizer(target: self, action: #selector(gestureClosePdfThumbnail)) swipePdfThumbnailScrollView.direction = .right pdfThumbnailScrollView.addGestureRecognizer(swipePdfThumbnailScrollView) - let edgePdfView = UIScreenEdgePanGestureRecognizer(target: self, action: #selector(gestureOpenPdfThumbnail)) - edgePdfView.edges = .right - pdfView.addGestureRecognizer(edgePdfView) - - let edgeView = UIScreenEdgePanGestureRecognizer(target: self, action: #selector(gestureOpenPdfThumbnail)) - edgeView.edges = .right - view.addGestureRecognizer(edgeView) - NotificationCenter.default.addObserver(self, selector: #selector(favoriteFile(_:)), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterFavoriteFile), object: nil) NotificationCenter.default.addObserver(self, selector: #selector(deleteFile(_:)), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterDeleteFile), object: nil) NotificationCenter.default.addObserver(self, selector: #selector(renameFile(_:)), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterRenameFile), object: nil) @@ -497,6 +502,13 @@ class NCViewerPDF: UIViewController, NCViewerPDFSearchDelegate, UIGestureRecogni } } +extension NCViewerPDF: UIGestureRecognizerDelegate { + + func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer) -> Bool { + return true + } +} + extension NCViewerPDF: EasyTipViewDelegate { func easyTipViewDidTap(_ tipView: EasyTipView) { |