Browse Source

【注释】修复“添加便签,属性面板更改不透明度后,在便签输入框刚刚颜色,不会同步属性面板的设置”

wanjun 10 months ago
parent
commit
0c29988171

+ 11 - 1
PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/KMGeneralAnnotationViewController.swift

@@ -406,7 +406,7 @@ let KMColorPickerViewHeight: CGFloat = 64
         }
 //        NotificationCenter.default.addObserver(self, selector: #selector(alignmentTypeNotification(_:)), name: "KMAnnotationAlignmentTypeNotification1", object: nil)
 //        NotificationCenter.default.addObserver(self, selector: #selector(loadingUIAndLocalization(_:)), name: "KMPreferenceDidChangeNotificationName", object: nil)
-//        NotificationCenter.default.addObserver(self, selector: #selector(annotationChangeNotification(_:)), name: CPDFListViewAnnotationsAttributeHasChangeNotification, object: nil)
+        NotificationCenter.default.addObserver(self, selector: #selector(annotationChangeNotification(_:)), name: NSNotification.Name(rawValue: "CPDFListViewAnnotationsAttributeHasChangeNotification"), object: nil)
     }
     
     override func viewDidLoad() {
@@ -2309,6 +2309,16 @@ let KMColorPickerViewHeight: CGFloat = 64
             updateViewColor()
         }
     }
+    
+    @objc func annotationChangeNotification(_ notification: NSNotification) {
+        if notification.object != nil {
+            let anno: [String : Any] = notification.object as! [String : Any]
+            let textAnno: CPDFAnnotation = anno["object"] as! CPDFAnnotation
+            if textAnno.isKind(of: CPDFTextAnnotation.self) {
+                textColorPickerView.setColor(textAnno.color)
+            }
+        }
+    }
 }
 
 class KMGeneralAnnotationColorButton: NSButton {