Browse Source

【注释】填写与签名注释创建报错、属性面板预览效果

wanjun 1 year ago
parent
commit
961931d75a

+ 15 - 15
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/CPDFAnnotationModel.m

@@ -293,19 +293,19 @@
                 color = [userDefaults PDFListViewColorForKey:CInkNoteColorKey];
                 break;
             case CAnnotationTypeSignFalse:
-                color = [userDefaults PDFListViewColorForKey:CAnnotationSelfSignFalseColorKey];
+                color = [userDefaults PDFListViewColorForKey:CAnnotationSelfSignFalseColorKey] ? : NSColor.blackColor;
                 break;
             case CAnnotationTypeSignTure:
-                color = [userDefaults PDFListViewColorForKey:CAnnotationSelfSignTureColorKey];
+                color = [userDefaults PDFListViewColorForKey:CAnnotationSelfSignTureColorKey] ? : NSColor.blackColor;
                 break;
             case CAnnotationTypeSignCircle:
-                color = [userDefaults PDFListViewColorForKey:CAnnotationSelfSignCircleColorKey];
+                color = [userDefaults PDFListViewColorForKey:CAnnotationSelfSignCircleColorKey] ? : NSColor.blackColor;
                 break;
             case CAnnotationTypeSignLine:
-                color = [userDefaults PDFListViewColorForKey:CAnnotationSelfSignLineColorKey];
+                color = [userDefaults PDFListViewColorForKey:CAnnotationSelfSignLineColorKey] ? : NSColor.blackColor;
                 break;
             case CAnnotationTypeSignDot:
-                color = [userDefaults PDFListViewColorForKey:CAnnotationSelfSignDotColorKey];
+                color = [userDefaults PDFListViewColorForKey:CAnnotationSelfSignDotColorKey] ? : NSColor.blackColor;
                 break;
             case CAnnotationTypeRedact:
                 color = [userDefaults PDFListViewColorForKey:CAnnotationRedactBorderColorKey];
@@ -899,19 +899,19 @@
                 width = [userDefaults floatForKey:CDefaultSignatureNoteWidthKey];
                 break;
             case CAnnotationTypeSignFalse:
-                width = [userDefaults floatForKey:CDefaultSignFalseNoteWidthKey];
+                width = [userDefaults floatForKey:CDefaultSignFalseNoteWidthKey] < 0.001 ? 16 : [userDefaults floatForKey:CDefaultSignFalseNoteWidthKey];
                 break;
             case CAnnotationTypeSignTure:
-                width = [userDefaults floatForKey:CDefaultSignTureNoteWidthKey];
+                width = [userDefaults floatForKey:CDefaultSignTureNoteWidthKey] < 0.001 ? 16 : [userDefaults floatForKey:CDefaultSignTureNoteWidthKey];
                 break;
             case CAnnotationTypeSignCircle:
-                width = [userDefaults floatForKey:CDefaultSignCircleNoteWidthKey];
+                width = [userDefaults floatForKey:CDefaultSignCircleNoteWidthKey] < 0.001 ? 16 : [userDefaults floatForKey:CDefaultSignCircleNoteWidthKey];
                 break;
             case CAnnotationTypeSignLine:
-                width = [userDefaults floatForKey:CDefaultSignLineNoteWidthKey];
+                width = [userDefaults floatForKey:CDefaultSignLineNoteWidthKey] < 0.001 ? 16 : [userDefaults floatForKey:CDefaultSignLineNoteWidthKey];
                 break;
             case CAnnotationTypeSignDot:
-                width = [userDefaults floatForKey:CDefaultSignDotNoteWidthKey];
+                width = [userDefaults floatForKey:CDefaultSignDotNoteWidthKey] < 0.001 ? 16 : [userDefaults floatForKey:CDefaultSignDotNoteWidthKey];
                 break;
             default:
                 width = [userDefaults floatForKey:CDefaultNoteWidthKey];
@@ -1012,19 +1012,19 @@
                 height = [userDefaults floatForKey:CDefaultSignatureNoteHeightKey];
                 break;
             case CAnnotationTypeSignFalse:
-                height = [userDefaults floatForKey:CDefaultSignFalseNoteHeightKey];
+                height = [userDefaults floatForKey:CDefaultSignFalseNoteHeightKey] < 0.001 ? 16 : [userDefaults floatForKey:CDefaultSignFalseNoteHeightKey];
                 break;
             case CAnnotationTypeSignTure:
-                height = [userDefaults floatForKey:CDefaultSignTureNoteHeightKey];
+                height = [userDefaults floatForKey:CDefaultSignTureNoteHeightKey] < 0.001 ? 16 : [userDefaults floatForKey:CDefaultSignTureNoteHeightKey];
                 break;
             case CAnnotationTypeSignCircle:
-                height = [userDefaults floatForKey:CDefaultSignCircleNoteHeightKey];
+                height = [userDefaults floatForKey:CDefaultSignCircleNoteHeightKey] < 0.001 ? 16 : [userDefaults floatForKey:CDefaultSignCircleNoteHeightKey];
                 break;
             case CAnnotationTypeSignLine:
-                height = [userDefaults floatForKey:CDefaultSignLineNoteHeightKey];
+                height = [userDefaults floatForKey:CDefaultSignLineNoteHeightKey] < 0.001 ? 16 : [userDefaults floatForKey:CDefaultSignLineNoteHeightKey];
                 break;
             case CAnnotationTypeSignDot:
-                height = [userDefaults floatForKey:CDefaultSignDotNoteHeightKey];
+                height = [userDefaults floatForKey:CDefaultSignDotNoteHeightKey] < 0.001 ? 16 : [userDefaults floatForKey:CDefaultSignDotNoteHeightKey];
                 break;
             default:
                 height = [userDefaults floatForKey:CDefaultNoteHeightKey];

+ 1 - 1
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/CPDFStampAnnotation+PDFListView.swift

@@ -36,7 +36,7 @@ import Foundation
             context?.setStrokeColor(paintColor.cgColor)
             context?.setFillColor(paintColor.cgColor)
             context?.strokePath()
-        } else if (annotationModel.stampAnnotationType() == .signature) {
+        } else if (annotationModel.stampAnnotationType() == .signTure) {
             context?.move(to: CGPoint(x: CGRectGetMinX(bounds) + lineWidth/2, y: CGRectGetMidY(bounds) + lineWidth/2))
             context?.addLine(to: CGPoint(x: CGRectGetMinX(bounds) + CGRectGetWidth(bounds)/3.0, y: CGRectGetMinY(bounds) + lineWidth/2))
             context?.addLine(to: CGPoint(x: CGRectGetMaxX(bounds) - lineWidth/2, y: CGRectGetMaxY(bounds) - lineWidth/2))

+ 1 - 1
PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/ViewController/KMAnnotationSelfSignViewController.swift

@@ -89,7 +89,7 @@ typealias KMAnnotationSelfSignViewControllerCallBack = (CAnnotationType) -> Void
         color?.usingColorSpaceName(.calibratedRGB)?.getRed(nil, green: nil, blue: nil, alpha: &opacity)
         opacityComboBox.stringValue = "\(Int(opacity * 100))%"
         opacitySlider.floatValue = Float(opacity)
-        imageView.image = drawImage(with: selfSignType)
+        imageView.image = annotationModel?.annotationImage
 
         // ComboBox Configuration
         opacityComboBox.type = .none