diff --git a/Zotero/Controllers/AnnotationConverter.swift b/Zotero/Controllers/AnnotationConverter.swift index 00759129b..f35ce2aa4 100644 --- a/Zotero/Controllers/AnnotationConverter.swift +++ b/Zotero/Controllers/AnnotationConverter.swift @@ -112,7 +112,7 @@ struct AnnotationConverter { paths = [] } else if let annotation = annotation as? PSPDFKit.FreeTextAnnotation { type = .freeText - let roundedFontSize = round(annotation.fontSize * 2) / 2 + let roundedFontSize = AnnotationsConfig.roundFreeTextAnnotationFontSize(annotation.fontSize) fontSize = roundedFontSize rotation = annotation.rotation paths = [] diff --git a/Zotero/Models/AnnotationsConfig.swift b/Zotero/Models/AnnotationsConfig.swift index d9fdbd528..754f608f5 100644 --- a/Zotero/Models/AnnotationsConfig.swift +++ b/Zotero/Models/AnnotationsConfig.swift @@ -29,6 +29,13 @@ struct AnnotationsConfig { static let keyKey = "Zotero:Key" // Line width of image annotation in PDF document. static let imageAnnotationLineWidth: CGFloat = 2 + // Free text annotation font size minimum, maximum, increment and rounding + static let freeTextAnnotationFontSizeMinimum: CGFloat = 1 + static let freeTextAnnotationFontSizeMaximum: CGFloat = 200 + static let freeTextAnnotationFontSizeIncrement: CGFloat = 0.5 + static func roundFreeTextAnnotationFontSize(_ fontSize: CGFloat) -> CGFloat { + round(fontSize * 2) / 2 + } // Size of note annotation in PDF document. static let noteAnnotationSize: CGSize = CGSize(width: 22, height: 22) static let positionSizeLimit = 65000 diff --git a/Zotero/Scenes/Detail/Annotation Popover/Views/FontSizeView.swift b/Zotero/Scenes/Detail/Annotation Popover/Views/FontSizeView.swift index 8b9670ddd..7d6c45025 100644 --- a/Zotero/Scenes/Detail/Annotation Popover/Views/FontSizeView.swift +++ b/Zotero/Scenes/Detail/Annotation Popover/Views/FontSizeView.swift @@ -78,9 +78,9 @@ final class FontSizeView: UIView { private func setup() { let stepper = UIStepper() stepper.isHidden = !stepperEnabled - stepper.stepValue = 0.5 - stepper.minimumValue = 1 - stepper.maximumValue = 200 + stepper.stepValue = AnnotationsConfig.freeTextAnnotationFontSizeIncrement + stepper.minimumValue = AnnotationsConfig.freeTextAnnotationFontSizeMinimum + stepper.maximumValue = AnnotationsConfig.freeTextAnnotationFontSizeMaximum stepper.rx.controlEvent(.valueChanged) .observe(on: MainScheduler.instance) .subscribe(onNext: { [weak self] _ in diff --git a/Zotero/Scenes/Detail/PDF/ViewModels/PDFReaderActionHandler.swift b/Zotero/Scenes/Detail/PDF/ViewModels/PDFReaderActionHandler.swift index 5b113ff19..0463b8de8 100644 --- a/Zotero/Scenes/Detail/PDF/ViewModels/PDFReaderActionHandler.swift +++ b/Zotero/Scenes/Detail/PDF/ViewModels/PDFReaderActionHandler.swift @@ -1675,7 +1675,7 @@ final class PDFReaderActionHandler: ViewModelActionHandler, BackgroundDbProcessi } if editFontSize { - let roundedFontSize = round(textAnnotation.fontSize * 2) / 2 + let roundedFontSize = AnnotationsConfig.roundFreeTextAnnotationFontSize(textAnnotation.fontSize) requests.append(EditAnnotationFontSizeDbRequest(key: key, libraryId: viewModel.state.library.identifier, size: roundedFontSize)) } } else if hasChanges([.boundingBox, .rects]), let rects = AnnotationConverter.rects(from: annotation) {