Skip to content

Commit

Permalink
Fix regression (#1031)
Browse files Browse the repository at this point in the history
  • Loading branch information
mvasilak authored Nov 28, 2024
1 parent 6c76c8e commit 0c2f888
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions Zotero/Scenes/Detail/PDF/Views/PDFDocumentViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -509,8 +509,7 @@ final class PDFDocumentViewController: UIViewController {
private func select(annotation: PDFAnnotation, pageIndex: PageIndex, document: PSPDFKit.Document) {
guard let pdfController,
let pageView = updateSelectionOnVisiblePages(of: pdfController, annotation: annotation) ?? pdfController.pageViewForPage(at: pageIndex),
let pdfAnnotation = document.annotation(on: Int(pageView.pageIndex), with: annotation.key),
pageView.selectedAnnotations.contains(pdfAnnotation)
let pdfAnnotation = document.annotation(on: Int(pageView.pageIndex), with: annotation.key)
else { return }
pageView.selectedAnnotations = [pdfAnnotation]
}
Expand Down Expand Up @@ -958,7 +957,16 @@ extension PDFDocumentViewController: UIPencilInteractionDelegate {
}
}

extension PDFDocumentViewController: UIPopoverPresentationControllerDelegate { }
extension PDFDocumentViewController: UIPopoverPresentationControllerDelegate {
func presentationControllerDidDismiss(_ presentationController: UIPresentationController) {
guard let presentedNavigationController = presentationController.presentedViewController as? NavigationViewController,
(presentedNavigationController.children.first as? AnnotationPopoverViewController) != nil,
let type = viewModel.state.selectedAnnotation?.type,
type == .highlight || type == .underline
else { return }
viewModel.process(action: .deselectSelectedAnnotation)
}
}

extension PDFDocumentViewController: AnnotationBoundingBoxConverter {
/// Converts from database to PSPDFKit rect. Database stores rects in RAW PDF Coordinate space. PSPDFKit works with Normalized PDF Coordinate Space.
Expand Down

0 comments on commit 0c2f888

Please sign in to comment.