Skip to content

Commit

Permalink
Allow rendering of document annotations (#1042)
Browse files Browse the repository at this point in the history
  • Loading branch information
michalrentka authored Dec 12, 2024
1 parent 6d803cd commit 6f8e87d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Zotero/Controllers/AnnotationPreviewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ final class AnnotationPreviewController: NSObject {
}

init?(annotation: PSPDFKit.Annotation, parentKey: String, libraryId: LibraryIdentifier, imageSize: CGSize, imageScale: CGFloat, isDark: Bool, type: PreviewType) {
guard annotation.shouldRenderPreview && annotation.isZoteroAnnotation, let document = annotation.document else { return nil }
guard annotation.shouldRenderPreview, let document = annotation.document else { return nil }
key = annotation.previewId
self.parentKey = parentKey
self.libraryId = libraryId
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -301,12 +301,10 @@ final class PDFReaderActionHandler: ViewModelActionHandler, BackgroundDbProcessi
private func storeAnnotationPreviewsIfNeeded(isDark: Bool, in viewModel: ViewModel<PDFReaderActionHandler>) {
let libraryId = viewModel.state.library.identifier

// Load area annotations if needed.
// Load annotation previews if needed.
for (_, annotations) in viewModel.state.document.allAnnotations(of: [.square, .ink, .freeText]) {
for annotation in annotations {
guard annotation.shouldRenderPreview && annotation.isZoteroAnnotation &&
!annotationPreviewController.hasPreview(for: annotation.previewId, parentKey: viewModel.state.key, libraryId: libraryId, isDark: isDark)
else { continue }
guard !annotationPreviewController.hasPreview(for: annotation.previewId, parentKey: viewModel.state.key, libraryId: libraryId, isDark: isDark) else { continue }
annotationPreviewController.store(for: annotation, parentKey: viewModel.state.key, libraryId: libraryId, isDark: isDark)
}
}
Expand Down

0 comments on commit 6f8e87d

Please sign in to comment.