Przeglądaj źródła

【注释】修复“日期注释切换字体颜色影响填充颜色”

wanjun 10 miesięcy temu
rodzic
commit
7cf2064924

+ 12 - 17
PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/KMGeneralAnnotationViewController.swift

@@ -1723,12 +1723,19 @@ let KMColorPickerViewHeight: CGFloat = 64
         var red: CGFloat = 0.0, green: CGFloat = 0.0, blue: CGFloat = 0.0, opacity: CGFloat = 0.0
         if let fontViewPickerColor = fontViewCorloPV.color {
             fontViewPickerColor.usingColorSpaceName(.calibratedRGB)?.getRed(&red, green: &green, blue: &blue, alpha: &opacity)
-            if annotationType == .freeText || annotationType == .signText || annotationType == .signDate  {
-                annotationModel?.setFontColor(fontViewPickerColor)
+            if fabs(opacity - 0) < 0.001 {
+                if annotationType == .freeText || annotationType == .signText || annotationType == .signDate  {
+                    annotationModel?.setFontColor(.black)
+//                    annotationModel?.setOpacity(0)
+                }
             } else {
-                annotationModel?.setColor(fontViewPickerColor)
+                if annotationType == .freeText || annotationType == .signText || annotationType == .signDate  {
+                    annotationModel?.setFontColor(fontViewPickerColor)
+//                    annotationModel?.setOpacity(opacity)
+                } else {
+                    annotationModel?.setColor(fontViewPickerColor)
+                }
             }
-            annotationModel?.setOpacity(opacity)
         }
         
         updateAnnotation(.color)
@@ -1756,18 +1763,6 @@ let KMColorPickerViewHeight: CGFloat = 64
             }
         } else if annotationType == .freeText || annotationType == .signDate || annotationType == .signText {
             annotationModel?.setOpacity(opcity)
-            
-            var color = annotationModel?.fontColor()
-            if annotationModel?.opacity() != 0 {
-                var red: CGFloat = 0.0
-                var green: CGFloat = 0.0
-                var blue: CGFloat = 0.0
-                var opacity: CGFloat = 0.0
-                color?.usingColorSpaceName(.calibratedRGB)?.getRed(&red, green: &green, blue: &blue, alpha: &opacity)
-                color = NSColor(red: red, green: green, blue: blue, alpha: (annotationModel?.opacity()) ?? self.kDefaultOpacity_)
-            } else {
-                color = .clear
-            }
         } else {
             annotationModel?.setOpacity(opcity)
         }
@@ -1797,7 +1792,7 @@ let KMColorPickerViewHeight: CGFloat = 64
                 annotationModel?.setInteriorColor(nil)
             }
         } else if annotationType == .freeText || annotationType == .signDate || annotationType == .signText {
-            annotationModel?.setInteriorOpacity(opcity)
+            annotationModel?.setOpacity(opcity)
         } else {
             annotationModel?.setOpacity(opcity)
         }