From c7bbe7b433ff6900b3d16d1515a6c4eb99c969bb Mon Sep 17 00:00:00 2001 From: marinofaggiana Date: Sat, 30 Apr 2022 12:49:48 +0200 Subject: Improveds Signed-off-by: marinofaggiana --- iOSClient/Viewer/NCViewerPDF/NCViewerPDF.swift | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/iOSClient/Viewer/NCViewerPDF/NCViewerPDF.swift b/iOSClient/Viewer/NCViewerPDF/NCViewerPDF.swift index c72af9d07..355ba4b33 100644 --- a/iOSClient/Viewer/NCViewerPDF/NCViewerPDF.swift +++ b/iOSClient/Viewer/NCViewerPDF/NCViewerPDF.swift @@ -97,7 +97,7 @@ class NCViewerPDF: UIViewController, NCViewerPDFSearchDelegate, UIGestureRecogni view.addSubview(pdfThumbnailScrollView) NSLayoutConstraint.activate([ - pdfThumbnailScrollView.topAnchor.constraint(equalTo: view.topAnchor), + pdfThumbnailScrollView.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor), pdfThumbnailScrollView.bottomAnchor.constraint(equalTo: view.bottomAnchor) ]) pdfThumbnailScrollViewleadingAnchor = pdfThumbnailScrollView.leadingAnchor.constraint(equalTo: view.leadingAnchor) @@ -342,9 +342,9 @@ class NCViewerPDF: UIViewController, NCViewerPDFSearchDelegate, UIGestureRecogni @objc func tapPdfView(_ recognizer: UITapGestureRecognizer) { if navigationController?.isNavigationBarHidden ?? false { - navigationController?.setNavigationBarHidden(false, animated: false) + navigationController?.setNavigationBarHidden(false, animated: true) } else { - navigationController?.setNavigationBarHidden(true, animated: false) + navigationController?.setNavigationBarHidden(true, animated: true) } } @@ -427,15 +427,7 @@ class NCViewerPDF: UIViewController, NCViewerPDFSearchDelegate, UIGestureRecogni let endY = visibleRect.origin.y + visibleRect.height + thumbnailViewHeight if currentPageY < startY { - if gotoY < 0 { - let safeAreaInsetsTop = UIApplication.shared.keyWindow?.safeAreaInsets.top ?? 0 - let statusBarFrameHeight = UIApplication.shared.statusBarFrame.height - if navigationController?.isNavigationBarHidden ?? true { - gotoY = -statusBarFrameHeight - } else { - gotoY = safeAreaInsetsTop == 0 ? -statusBarFrameHeight : -(safeAreaInsetsTop + statusBarFrameHeight) - } - } + if gotoY < 0 { gotoY = 0 } pdfThumbnailScrollView.setContentOffset(CGPoint(x: 0, y: gotoY), animated: true) } else if currentPageY > endY { if gotoY > pdfThumbnailView.frame.height - visibleRect.height { -- cgit v1.2.3