Преглед изворни кода

【Form】文本域默认颜色不应当是黑色

lizhe пре 6 месеци
родитељ
комит
70f20841b3

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

@@ -1775,22 +1775,22 @@
         NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
         switch (_annotationType) {
             case CAnnotationTypeTextField:
-                backgroundColor = [userDefaults PDFListViewColorForKey:CAnnotationTextWidgetBackgroundColorKey] ? : NSColor.grayColor;
+                backgroundColor = [userDefaults PDFListViewColorForKey:CAnnotationTextWidgetBackgroundColorKey] ? : NSColor.clearColor;
                 break;
             case CAnnotationTypeRadioButton:
-                backgroundColor = [userDefaults PDFListViewColorForKey:CAnnotationRadioButtonWidgetBackgroundColorKey];
+                backgroundColor = [userDefaults PDFListViewColorForKey:CAnnotationRadioButtonWidgetBackgroundColorKey] ? : NSColor.clearColor;;
                 break;
             case CAnnotationTypeCheckBox:
-                backgroundColor = [userDefaults PDFListViewColorForKey:CAnnotationCheckBoxWidgetBackgroundColorKey];
+                backgroundColor = [userDefaults PDFListViewColorForKey:CAnnotationCheckBoxWidgetBackgroundColorKey] ? : NSColor.clearColor;;
                 break;
             case CAnnotationTypeComboBox:
-                backgroundColor = [userDefaults PDFListViewColorForKey:CAnnotationActionButtonWidgetBackgroundColorKey] ? : NSColor.grayColor;
+                backgroundColor = [userDefaults PDFListViewColorForKey:CAnnotationActionButtonWidgetBackgroundColorKey] ? : NSColor.clearColor;
                 break;
             case CAnnotationTypeListMenu:
-                backgroundColor = [userDefaults PDFListViewColorForKey:CAnnotationChoiceListWidgetBackgroundColorKey] ? : NSColor.grayColor;
+                backgroundColor = [userDefaults PDFListViewColorForKey:CAnnotationChoiceListWidgetBackgroundColorKey] ? : NSColor.clearColor;
                 break;
             case CAnnotationTypeActionButton:
-                backgroundColor = [userDefaults PDFListViewColorForKey:CAnnotationActionButtonWidgetBackgroundColorKey];
+                backgroundColor = [userDefaults PDFListViewColorForKey:CAnnotationActionButtonWidgetBackgroundColorKey] ? : NSColor.clearColor;;
                 break;
             default:
                 break;
@@ -1800,7 +1800,7 @@
         CGFloat red,green,blue,alpha;
         [[backgroundColor colorUsingColorSpaceName:NSCalibratedRGBColorSpace] getRed:&red green:&green blue:&blue alpha:&alpha];
         if ((fabs(alpha - 0) < 0.001)) {
-            backgroundColor = nil;
+            backgroundColor = [NSColor clearColor];
         }
     }
     return backgroundColor;

+ 2 - 0
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFListViewExtension/CPDFListView+Event.m

@@ -3655,8 +3655,10 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
             NSColor* backgroundColor = [sud colorForKey:CAnnotationTextWidgetBackgroundColorKey];
             if (backgroundColor) {
                 textWidget.backgroundColor = backgroundColor;
+                textWidget.backgroundOpacity = 1;
             } else {
                 textWidget.backgroundColor = [NSColor clearColor];
+                textWidget.backgroundOpacity = 0;
             }
             
             NSColor* fontColor = [sud colorForKey:CAnnotationTextWidgetFontColorKey];

+ 8 - 2
PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/ViewController/FormProperties/KMAnnotationFromViewController.swift

@@ -405,12 +405,18 @@ import Cocoa
     }
 
     @IBAction func fillColorPickerViewAction(_ sender: Any) {
+        let color = fillColorPickerView.color
         if annotations.count > 0 {
             for tAnnotation in annotations {
-                tAnnotation.backgroundColor = fillColorPickerView.color
+                tAnnotation.backgroundColor = color
+                if color == NSColor.clear {
+                    tAnnotation.backgroundOpacity = 0
+                } else {
+                    tAnnotation.backgroundOpacity = 1
+                }
             }
         } else {
-            annotationModel.setBackgroundColor(fillColorPickerView.color)
+            annotationModel.setBackgroundColor(color)
             updateAnnotationMode()
         }
         updateAnnotation()