Browse Source

【注释】修复“Form 按钮填充颜色调整无效”

wanjun 10 months ago
parent
commit
b3a717d883

+ 9 - 7
PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/ViewController/FormProperties/KMAnnotationChoiceWidgetAppearanceViewController.swift

@@ -298,8 +298,8 @@ private enum KMPDFAnnotationFontWeightType: Int {
     private func updateAnnotation() {
         if annotationModel?.annotation != nil {
             for tAnnotation in annotations {
-                tAnnotation.updateAppearanceStream()
                 pdfView?.setNeedsDisplayAnnotationViewFor(tAnnotation.page)
+                tAnnotation.updateAppearanceStream()
             }
         }
     }
@@ -356,14 +356,16 @@ private enum KMPDFAnnotationFontWeightType: Int {
     }
 
     @IBAction func fillColorPickerViewAction(_ sender: Any) {
-        if annotations.count > 0 {
-            for tAnnotation in annotations {
-                tAnnotation.backgroundColor = fillColorPickerView.color
+        var color = self.fillColorPickerView.color
+        var r: CGFloat = 0.0, g: CGFloat = 0.0, b: CGFloat = 0.0, a: CGFloat = 0.0
+        if color != nil {
+            color!.usingColorSpace(.deviceRGB)?.getRed(&r, green: &g, blue: &b, alpha: &a)
+            if fabs(a - 0) < 0.001 {
+                color = .clear
             }
-        } else {
-            annotationModel?.setBackgroundColor(fillColorPickerView.color)
-            updateAnnotationMode()
         }
+        annotationModel?.setBackgroundColor(color)
+        annotationModel?.setBackgroundOpacity(a)
         updateAnnotation()
     }