|
@@ -18,6 +18,25 @@ class KMTextAlignmentController: NSViewController {
|
|
|
|
|
|
var itemAction: KMCommonClickBlock?
|
|
|
|
|
|
+ var align: NSTextAlignment = .center {
|
|
|
+ didSet {
|
|
|
+ let data = self.align
|
|
|
+ if data == .left {
|
|
|
+ self.leftVc_?.state = .Act
|
|
|
+ self.centerVc_?.state = .Norm
|
|
|
+ self.rightVc_?.state = .Norm
|
|
|
+ } else if data == .center {
|
|
|
+ self.leftVc_?.state = .Norm
|
|
|
+ self.centerVc_?.state = .Act
|
|
|
+ self.rightVc_?.state = .Norm
|
|
|
+ } else if data == .right {
|
|
|
+ self.leftVc_?.state = .Norm
|
|
|
+ self.centerVc_?.state = .Norm
|
|
|
+ self.rightVc_?.state = .Act
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
override func viewDidLoad() {
|
|
|
super.viewDidLoad()
|
|
|
|
|
@@ -32,6 +51,11 @@ class KMTextAlignmentController: NSViewController {
|
|
|
self.leftVc_?.image = NSImage(named: "KMImageNameEditPDFAlignLeftSelect")!
|
|
|
self.leftVc_?.tag = 0
|
|
|
|
|
|
+ self.leftVc_?.initDefaultValue()
|
|
|
+ self.leftVc_?.borderWidth = 0
|
|
|
+ self.leftVc_?.borderWidth_hov = 0
|
|
|
+ self.leftVc_?.borderWidth_act = 0
|
|
|
+
|
|
|
self.centerVc_ = KMDesignButton(withType: .Image)
|
|
|
self.centerBox.contentView = self.centerVc_!.view
|
|
|
self.centerBox.borderWidth = 0
|
|
@@ -41,6 +65,11 @@ class KMTextAlignmentController: NSViewController {
|
|
|
self.centerVc_?.image = NSImage(named: "KMImageNameEditPDFAlignCenterSelect")!
|
|
|
self.centerVc_?.tag = 1
|
|
|
|
|
|
+ self.centerVc_?.initDefaultValue()
|
|
|
+ self.centerVc_?.borderWidth = 0
|
|
|
+ self.centerVc_?.borderWidth_hov = 0
|
|
|
+ self.centerVc_?.borderWidth_act = 0
|
|
|
+
|
|
|
self.rightVc_ = KMDesignButton(withType: .Image)
|
|
|
self.rightBox.contentView = self.rightVc_!.view
|
|
|
self.rightBox.borderWidth = 0
|
|
@@ -50,6 +79,11 @@ class KMTextAlignmentController: NSViewController {
|
|
|
self.rightVc_?.image = NSImage(named: "KMImageNameEditPDFAlignRightSelect")!
|
|
|
self.rightVc_?.tag = 2
|
|
|
|
|
|
+ self.rightVc_?.initDefaultValue()
|
|
|
+ self.rightVc_?.borderWidth = 0
|
|
|
+ self.rightVc_?.borderWidth_hov = 0
|
|
|
+ self.rightVc_?.borderWidth_act = 0
|
|
|
+
|
|
|
self.reloadData()
|
|
|
}
|
|
|
|
|
@@ -63,6 +97,18 @@ class KMTextAlignmentController: NSViewController {
|
|
|
self.leftVc_?.background_hov = NSColor(red: 71/255, green: 72/255, blue: 75/255, alpha: 1)
|
|
|
self.centerVc_?.background_hov = NSColor(red: 71/255, green: 72/255, blue: 75/255, alpha: 1)
|
|
|
self.rightVc_?.background_hov = NSColor(red: 71/255, green: 72/255, blue: 75/255, alpha: 1)
|
|
|
+
|
|
|
+ leftVc_?.background = NSColor.clear
|
|
|
+ leftVc_?.background_hov = NSColor(red: 71/255, green: 72/255, blue: 75/255, alpha: 1)
|
|
|
+ leftVc_?.background_act = KMAppearance.Interactive.m1Color()
|
|
|
+
|
|
|
+ centerVc_?.background = NSColor.clear
|
|
|
+ centerVc_?.background_hov = NSColor(red: 71/255, green: 72/255, blue: 75/255, alpha: 1)
|
|
|
+ centerVc_?.background_act = KMAppearance.Interactive.m1Color()
|
|
|
+
|
|
|
+ rightVc_?.background = NSColor.clear
|
|
|
+ rightVc_?.background_hov = NSColor(red: 71/255, green: 72/255, blue: 75/255, alpha: 1)
|
|
|
+ rightVc_?.background_act = KMAppearance.Interactive.m1Color()
|
|
|
} else {
|
|
|
self.view.layer?.backgroundColor = .white
|
|
|
self.leftVc_?.background_hov = NSColor(red: 237/255, green: 238/255, blue: 240/255, alpha: 1)
|