Преглед на файлове

Fix pdf search

Signed-off-by: marinofaggiana <ios@nextcloud.com>
marinofaggiana преди 2 години
родител
ревизия
19822e1d05
променени са 1 файла, в които са добавени 10 реда и са изтрити 3 реда
  1. 10 3
      iOSClient/Viewer/NCViewerPDF/NCViewerPDF.swift

+ 10 - 3
iOSClient/Viewer/NCViewerPDF/NCViewerPDF.swift

@@ -474,9 +474,16 @@ class NCViewerPDF: UIViewController, NCViewerPDFSearchDelegate {
 
     func searchPdfSelection(_ pdfSelection: PDFSelection) {
 
-        pdfSelection.color = .yellow
-        pdfView.currentSelection = pdfSelection
-        pdfView.go(to: pdfSelection)
+        pdfSelection.pages.forEach { page in
+            let highlight = PDFAnnotation(bounds: pdfSelection.bounds(for: page), forType: .highlight, withProperties: nil)
+            highlight.endLineStyle = .square
+            highlight.color = .yellow
+            page.addAnnotation(highlight)
+        }
+        if let page = pdfSelection.pages.first {
+            pdfView.go(to: page)
+        }
+        handlePageChange()
     }
 
     private func selectPage(with label: String) {