Browse Source

Improved algorithm scroll

Signed-off-by: marinofaggiana <ios@nextcloud.com>
marinofaggiana 2 năm trước cách đây
mục cha
commit
10d47a73af
1 tập tin đã thay đổi với 7 bổ sung1 xóa
  1. 7 1
      iOSClient/Viewer/NCViewerPDF/NCViewerPDF.swift

+ 7 - 1
iOSClient/Viewer/NCViewerPDF/NCViewerPDF.swift

@@ -427,7 +427,13 @@ class NCViewerPDF: UIViewController, NCViewerPDFSearchDelegate, UIGestureRecogni
         let endY = visibleRect.origin.y + visibleRect.height + thumbnailViewHeight
 
         if currentPageY < startY {
-            if gotoY < 0 { gotoY = -UIApplication.shared.statusBarFrame.height }
+            if gotoY < 0 {
+                if navigationController?.isNavigationBarHidden ?? true {
+                    gotoY = -UIApplication.shared.statusBarFrame.height
+                } else {
+                    gotoY = (UIApplication.shared.keyWindow?.safeAreaInsets.top ?? 0) == 0 ? -UIApplication.shared.statusBarFrame.height : -((UIApplication.shared.keyWindow?.safeAreaInsets.top ?? 0) + UIApplication.shared.statusBarFrame.height)
+                }
+            }
             pdfThumbnailScrollView.setContentOffset(CGPoint(x: 0, y: gotoY), animated: true)
         } else if currentPageY > endY {
             if gotoY > pdfThumbnailView.frame.height - visibleRect.height { gotoY = pdfThumbnailView.frame.height - visibleRect.height}