Bläddra i källkod

【注释】修复“填写与签名 点击添加的圆点,右侧属性面板预览框未显示”

wanjun 11 månader sedan
förälder
incheckning
d9c3c6171e

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

@@ -11,10 +11,7 @@ import Foundation
     class func annotationImage(annotationModel: CPDFAnnotationModel) -> NSImage? {
         var image: NSImage?
 //        let bounds = CGRectMake(0, 0, annotationModel.noteWidth(), annotationModel.noteHeight())
-        var bounds = CGRectMake(0, 0, 20, 20)
-        if (annotationModel.stampAnnotationType() == .signDot) {
-            bounds = CGRectMake(0, 0, 40, 40)
-        }
+        let bounds = CGRectMake(0, 0, 50, 50)
         image = NSImage(size: bounds.size)
         image?.lockFocus()
         NSGraphicsContext.current?.imageInterpolation = .high
@@ -61,11 +58,13 @@ import Foundation
             paintColor.set()
             path.fill()
         } else if (annotationModel.stampAnnotationType() == .signDot) {
-            let r = 16.0
-            let path = NSBezierPath(roundedRect: CGRectInset(bounds, annotationModel.noteWidth(), annotationModel.noteWidth()), xRadius: r, yRadius: r)
-            path.lineWidth = lineWidth
-            paintColor.set()
-            path.fill()
+            context?.setStrokeColor(red: 0, green: 0, blue: 0, alpha: 1.0)
+            context?.setLineWidth(1.0)
+            let radius = min(bounds.width / 2.0 - 1, bounds.height / 2.0 - 1)
+            context?.addArc(center: CGPoint(x: bounds.midX, y: bounds.midY), radius: radius, startAngle: 0, endAngle: CGFloat.pi * 2, clockwise: true)
+            context?.setStrokeColor(paintColor.cgColor)
+            context?.setFillColor(paintColor.cgColor)
+            context?.fillPath()
         } else {
             if let stampAnnotation = annotationModel.annotation as? CPDFStampAnnotation {
                 image = stampAnnotation.stampImage()