Pārlūkot izejas kodu

填写与签名 - 【日期】默认数据加载

wanjun 1 gadu atpakaļ
vecāks
revīzija
cbf4660b16

+ 30 - 3
PDF Office/PDF Office/Class/PDFWindowController/Side/RightSide/AnnotationProperty/ViewController/KMFillSignTextPanel.swift

@@ -147,8 +147,23 @@ class KMFillSignTextPanel: KMPropertiesPanelSubViewController {
         } else if (annotationModel.alignment() == .right) {
             rightVC.state = .Sel
         }
-        self.opacitySlider.floatValue = Float(self.annotationModel.opacity())
-        self.opacityVC.stringValue = String(format: "%f", self.annotationModel.opacity())
+        if self.annotationModel.color() != nil {
+            let component = self.annotationModel.color().cgColor.components
+            if component != nil {
+                self.opacitySlider.floatValue = Float((component?.last)!)
+                self.opacityVC.stringValue = String(format: "%.f", (component?.last)!*100) + "%"
+            }
+        } else {
+            self.opacitySlider.floatValue = 0
+            self.opacityVC.stringValue = "0%"
+        }
+        if annotationModel.annotationType == .signDate {
+            if annotationModel.includeTime() {
+                showTimeVC.state = .Checked
+            } else {
+                showTimeVC.state = .Norm
+            }
+        }
     }
     
     func initializeUI() {
@@ -309,7 +324,7 @@ class KMFillSignTextPanel: KMPropertiesPanelSubViewController {
             colorVC2.fillColor = self.colors[1]
             colorVC3.fillColor = self.colors[2]
             colorVC4.fillColor = self.colors[3]
-            
+                        
             let includeTime = self.annotationModel.includeTime()
             dateTypeVC.addItems(withObjectValues: KMSelfSignAnnotationFreeText.fetchAllDateString(includeTime) as! [String])
             let dateFormatIndex = self.annotationModel.dateFormatIndex()
@@ -379,20 +394,32 @@ class KMFillSignTextPanel: KMPropertiesPanelSubViewController {
         colorVC2.state = .Norm
         colorVC3.state = .Norm
         colorVC4.state = .Norm
+
+        var component: [CGFloat]?
         if (sender == colorVC1.button) {
             colorVC1.state = .Sel
             annotationModel.setColor(colorVC1.fillColor)
+            component = colorVC1.fillColor.cgColor.components
         } else if (sender == colorVC2.button) {
             colorVC2.state = .Sel
             annotationModel.setColor(colorVC2.fillColor)
+            component = colorVC2.fillColor.cgColor.components
         } else if (sender == colorVC3.button) {
             colorVC3.state = .Sel
             annotationModel.setColor(colorVC3.fillColor)
+            component = colorVC3.fillColor.cgColor.components
         } else if (sender == colorVC4.button) {
             colorVC4.state = .Sel
             annotationModel.setColor(colorVC4.fillColor)
+            component = colorVC4.fillColor.cgColor.components
         } else if (sender == colorVC5.button) {
             annotationModel.setColor(colorVC5.fillColor)
+            component = colorVC5.fillColor.cgColor.components
+        }
+        if component != nil {
+            self.opacitySlider.floatValue = Float((component?.last)!)
+            self.opacityVC.stringValue = String(format: "%.f", (component?.last)!*100) + "%"
+            self.annotationModel.setOpacity((component?.last)!)
         }
 
         refreshUI()