|
@@ -0,0 +1,490 @@
|
|
|
+//
|
|
|
+// KMColorPickerView.swift
|
|
|
+// PDF Master
|
|
|
+//
|
|
|
+// Created by wanjun on 2023/11/22.
|
|
|
+//
|
|
|
+
|
|
|
+import Cocoa
|
|
|
+
|
|
|
+enum KMPropertiesColors: Int {
|
|
|
+ case markupHighlightColors
|
|
|
+ case markupOtherColors
|
|
|
+ case lineColors
|
|
|
+ case lineFillColors
|
|
|
+ case inkColors
|
|
|
+ case inkFillColors
|
|
|
+ case freeTextColors
|
|
|
+ case freeTextFillColors
|
|
|
+ case anchoredNoteColors
|
|
|
+ case fromColors
|
|
|
+ case fromFillColors
|
|
|
+ case selfSignColors
|
|
|
+ case editText
|
|
|
+ case otherColors
|
|
|
+}
|
|
|
+
|
|
|
+class KMColorPickerView: NSControl {
|
|
|
+
|
|
|
+ var color: NSColor?
|
|
|
+ private(set) var colors: [NSColor] = []
|
|
|
+ private(set) var firstButton: NSButton = NSButton()
|
|
|
+ var _annotationType: KMPropertiesColors = .markupHighlightColors
|
|
|
+ var isFillColor: Bool = false
|
|
|
+ var isFreeText: Bool = false
|
|
|
+ var isCallColorPanelAction: Bool = false
|
|
|
+ var annotationTypeString: String = ""
|
|
|
+ var noContentString: Bool = false
|
|
|
+ var hideColorPanelAlpha: Bool = false
|
|
|
+ var isVerticalMode: Bool = false
|
|
|
+
|
|
|
+ var buttons: [NSButton] = []
|
|
|
+ var customColorButton: NSButton = NSButton()
|
|
|
+ var customColorLayer: CALayer = CALayer()
|
|
|
+ var customColor: NSColor?
|
|
|
+ var updatingColor: Bool = false
|
|
|
+ var secterindex: Int = 0
|
|
|
+ var titleLabel: NSTextField = NSTextField()
|
|
|
+
|
|
|
+ // MARK: Init Methods
|
|
|
+
|
|
|
+ deinit {
|
|
|
+ NSColorPanel.shared.setTarget(nil)
|
|
|
+ NSColorPanel.shared.setAction(nil)
|
|
|
+ }
|
|
|
+
|
|
|
+ override var intrinsicContentSize: NSSize {
|
|
|
+ return NSMakeSize(40*6, 30)
|
|
|
+ }
|
|
|
+
|
|
|
+ // MARK: Get、Set
|
|
|
+
|
|
|
+ var annotationType: KMPropertiesColors {
|
|
|
+ set {
|
|
|
+ _annotationType = newValue
|
|
|
+
|
|
|
+ switch newValue {
|
|
|
+ case .markupHighlightColors:
|
|
|
+ colors = KMAnnotationPropertiesColorManager.manager.markHighlightColors
|
|
|
+ case .markupOtherColors:
|
|
|
+ colors = KMAnnotationPropertiesColorManager.manager.markOtherColors
|
|
|
+ case .lineColors:
|
|
|
+ colors = KMAnnotationPropertiesColorManager.manager.lineColors
|
|
|
+ case .lineFillColors:
|
|
|
+ colors = KMAnnotationPropertiesColorManager.manager.fillLineColors
|
|
|
+ case .inkColors:
|
|
|
+ colors = KMAnnotationPropertiesColorManager.manager.inkColors
|
|
|
+ case .inkFillColors:
|
|
|
+ colors = KMAnnotationPropertiesColorManager.manager.inkFillColors
|
|
|
+ case .freeTextColors:
|
|
|
+ colors = KMAnnotationPropertiesColorManager.manager.freeTextColors
|
|
|
+ case .freeTextFillColors:
|
|
|
+ colors = KMAnnotationPropertiesColorManager.manager.freeFillTextColors
|
|
|
+ case .anchoredNoteColors:
|
|
|
+ colors = KMAnnotationPropertiesColorManager.manager.anchoredNoteColors
|
|
|
+ case .fromColors:
|
|
|
+ colors = KMAnnotationPropertiesColorManager.manager.fromColors
|
|
|
+ case .fromFillColors:
|
|
|
+ colors = KMAnnotationPropertiesColorManager.manager.fromFillColors
|
|
|
+ case .selfSignColors, .editText:
|
|
|
+ colors = KMAnnotationPropertiesColorManager.manager.selfSignColors
|
|
|
+ case .otherColors:
|
|
|
+ colors = KMAnnotationPropertiesColorManager.manager.otherColors
|
|
|
+ }
|
|
|
+ }
|
|
|
+ get {
|
|
|
+ return _annotationType
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ func setColor(_ newValue: NSColor) -> Void {
|
|
|
+ self.color = newValue
|
|
|
+
|
|
|
+ for i in 0..<buttons.count {
|
|
|
+ let button = buttons[i]
|
|
|
+ button.layer?.borderColor = .clear
|
|
|
+ button.layer?.borderWidth = 0.0
|
|
|
+ }
|
|
|
+ var ischangeColor = isChangeColor(color)
|
|
|
+ var isSelected = false
|
|
|
+ for i in 0..<buttons.count {
|
|
|
+ let button = buttons[i]
|
|
|
+
|
|
|
+ if self.color != nil {
|
|
|
+ if isTheSameColor(self.color!, anotherColor: self.colors[i]) {
|
|
|
+ isSelected = true
|
|
|
+ button.layer?.borderColor = KMAppearance.Interactive.a0Color().cgColor
|
|
|
+ button.layer?.borderWidth = 2.0
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if isSelected {
|
|
|
+ customColorButton.layer?.borderWidth = 0.0
|
|
|
+
|
|
|
+ if customColor == nil {
|
|
|
+ customColor = self.color
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ customColorButton.layer?.borderWidth = 2.0
|
|
|
+ customColor = self.color
|
|
|
+ customColorButton.layer?.borderColor = KMAppearance.Interactive.a0Color().cgColor
|
|
|
+ }
|
|
|
+
|
|
|
+ customColorLayer.backgroundColor = customColor?.cgColor
|
|
|
+ }
|
|
|
+
|
|
|
+ // MARK: Private Method
|
|
|
+
|
|
|
+ private func setColors(_ newValue: [NSColor]) -> Void {
|
|
|
+ self.colors = newValue
|
|
|
+
|
|
|
+ while let lastSubview = self.subviews.last {
|
|
|
+ lastSubview.removeFromSuperview()
|
|
|
+ }
|
|
|
+
|
|
|
+ var width: CGFloat = 30.0
|
|
|
+ let space: CGFloat = 9.0
|
|
|
+ var posX: CGFloat = 0
|
|
|
+ var buttons: [NSButton] = []
|
|
|
+
|
|
|
+ for i in 0..<min(self.colors.count, 4) {
|
|
|
+ let color = self.colors[i]
|
|
|
+ let button = NSButton()
|
|
|
+ button.tag = i
|
|
|
+
|
|
|
+ if self.isVerticalMode {
|
|
|
+ button.frame = NSMakeRect(0, self.frame.height - posX - width, width, width)
|
|
|
+ } else {
|
|
|
+ button.frame = NSMakeRect(posX, 0, width, width)
|
|
|
+ }
|
|
|
+
|
|
|
+ button.title = ""
|
|
|
+ button.isBordered = false
|
|
|
+ button.wantsLayer = true
|
|
|
+ button.layer?.cornerRadius = button.frame.size.width / 2.0
|
|
|
+ button.target = self
|
|
|
+ button.action = #selector(buttonAction(_:))
|
|
|
+ self.addSubview(button)
|
|
|
+
|
|
|
+ if i == 0 {
|
|
|
+ self.firstButton = button
|
|
|
+ }
|
|
|
+
|
|
|
+ let menu = NSMenu(title: "")
|
|
|
+ var item: NSMenuItem?
|
|
|
+
|
|
|
+ if i == 0 && (self.annotationType == .lineColors || self.annotationType == .lineFillColors || self.annotationType == .inkFillColors || self.annotationType == .freeTextFillColors || self.annotationType == .fromFillColors) {
|
|
|
+ // Do nothing for this case
|
|
|
+ } else {
|
|
|
+ item = menu.addItem(withTitle: NSLocalizedString("Change Color...", comment: ""), action: #selector(menuItemChangeColorAction(_:)), keyEquivalent: "")
|
|
|
+ item?.representedObject = i as NSNumber
|
|
|
+ }
|
|
|
+
|
|
|
+ item = menu.addItem(withTitle: NSLocalizedString("Restore Default Colors", comment: ""), action: #selector(menuItemRestoreColorAction(_:)), keyEquivalent: "")
|
|
|
+ item?.representedObject = i as NSNumber
|
|
|
+ button.menu = menu
|
|
|
+ buttons.append(button)
|
|
|
+ posX += width + space
|
|
|
+
|
|
|
+ let layer = CAShapeLayer()
|
|
|
+ layer.frame = NSMakeRect(3, 3, width - 6, width - 6)
|
|
|
+ layer.cornerRadius = layer.frame.size.width / 2.0
|
|
|
+ layer.backgroundColor = color.cgColor
|
|
|
+ layer.borderWidth = 1.0
|
|
|
+ layer.borderColor = KMAppearance.Interactive.s0Color().cgColor
|
|
|
+
|
|
|
+ var red: CGFloat = 0, green: CGFloat = 0, blue: CGFloat = 0, alpha: CGFloat = 0
|
|
|
+ color.usingColorSpace(NSColorSpace.deviceRGB)?.getRed(&red, green: &green, blue: &blue, alpha: &alpha)
|
|
|
+
|
|
|
+ if alpha < 0.000000001 {
|
|
|
+ let x = (layer.frame.size.width - sqrt(pow(layer.frame.size.width, 2) / 2)) / 2
|
|
|
+ let path = CGMutablePath()
|
|
|
+ path.move(to: CGPoint(x: x, y: layer.frame.size.height - x))
|
|
|
+ path.addLine(to: CGPoint(x: layer.frame.size.width - x, y: x))
|
|
|
+ layer.path = path
|
|
|
+ layer.strokeColor = NSColor.red.cgColor
|
|
|
+ layer.lineWidth = 2.0
|
|
|
+
|
|
|
+ if #available(macOS 10.14, *) {
|
|
|
+ if let appearanceName = NSApp.effectiveAppearance.bestMatch(from: [.aqua, .darkAqua]), appearanceName == .darkAqua {
|
|
|
+ layer.backgroundColor = NSColor(red: 255.0/255.0, green: 255.0/255.0, blue: 255.0/255.0, alpha: 1).cgColor
|
|
|
+ }
|
|
|
+ }
|
|
|
+ path.closeSubpath()
|
|
|
+ }
|
|
|
+ button.layer?.addSublayer(layer)
|
|
|
+ }
|
|
|
+
|
|
|
+ self.buttons = buttons
|
|
|
+
|
|
|
+ if self.noContentString {
|
|
|
+ self.titleLabel = NSTextField(frame: CGRect(x: 0, y: width + 9, width: self.frame.size.width, height: 18))
|
|
|
+ self.titleLabel.stringValue = self.annotationTypeString
|
|
|
+ self.titleLabel.textColor = KMAppearance.Layout.h1Color()
|
|
|
+ self.titleLabel.isBezeled = false
|
|
|
+ self.titleLabel.drawsBackground = false
|
|
|
+ self.titleLabel.isEditable = false
|
|
|
+ self.titleLabel.isSelectable = false
|
|
|
+ self.titleLabel.font = NSFont.systemFont(ofSize: 13.0)
|
|
|
+ self.addSubview(self.titleLabel)
|
|
|
+ }
|
|
|
+
|
|
|
+ let customColorBox = NSBox(frame: CGRect(x: posX, y: 0, width: (width * 2 + space), height: width + 2))
|
|
|
+ if self.isVerticalMode {
|
|
|
+ customColorBox.frame = CGRect(x: 0, y: self.frame.height - posX - (width * 2 + space), width: width + 2, height: (width * 2 + space))
|
|
|
+ }
|
|
|
+
|
|
|
+ customColorBox.boxType = .custom
|
|
|
+ customColorBox.borderWidth = 1.0
|
|
|
+ customColorBox.borderColor = KMAppearance.Interactive.s0Color()
|
|
|
+ customColorBox.fillColor = KMAppearance.Layout.l1Color()
|
|
|
+ customColorBox.contentViewMargins = NSSize(width: 0, height: 0)
|
|
|
+ customColorBox.wantsLayer = true
|
|
|
+ customColorBox.cornerRadius = width / 2
|
|
|
+ self.addSubview(customColorBox)
|
|
|
+
|
|
|
+ self.customColorButton = NSButton()
|
|
|
+ if self.isVerticalMode {
|
|
|
+ self.customColorButton.frame = NSMakeRect(0, customColorBox.frame.height - width - 4, width, width)
|
|
|
+ } else {
|
|
|
+ self.customColorButton.frame = NSMakeRect(0, 0, width, width)
|
|
|
+ }
|
|
|
+ self.customColorButton.title = ""
|
|
|
+ self.customColorButton.isBordered = false
|
|
|
+ self.customColorButton.wantsLayer = true
|
|
|
+ self.customColorButton.layer?.cornerRadius = self.customColorButton.frame.size.width / 2.0
|
|
|
+ self.customColorButton.target = self
|
|
|
+ self.customColorButton.action = #selector(customColorButtonAction(_:))
|
|
|
+ customColorBox.addSubview(self.customColorButton)
|
|
|
+
|
|
|
+ self.customColorLayer = CALayer()
|
|
|
+ self.customColorLayer.frame = NSMakeRect(3, 3, width - 6, width - 6)
|
|
|
+ self.customColorLayer.cornerRadius = self.customColorLayer.frame.size.width / 2.0
|
|
|
+ self.customColorLayer.borderWidth = 1.0
|
|
|
+ self.customColorLayer.borderColor = KMAppearance.Interactive.s0Color().cgColor
|
|
|
+ self.customColorButton.layer?.addSublayer(self.customColorLayer)
|
|
|
+
|
|
|
+ let colorbutton = NSButton()
|
|
|
+ if self.isVerticalMode {
|
|
|
+ colorbutton.frame = NSMakeRect(2, 4, width - 4, width - 4)
|
|
|
+ } else {
|
|
|
+ colorbutton.frame = NSMakeRect(width + space, 2, width - 4, width - 4)
|
|
|
+ }
|
|
|
+ colorbutton.title = ""
|
|
|
+ colorbutton.isBordered = false
|
|
|
+ colorbutton.wantsLayer = true
|
|
|
+ colorbutton.layer?.cornerRadius = colorbutton.frame.size.width / 2.0
|
|
|
+ colorbutton.image = NSImage(named: "view_color")
|
|
|
+ colorbutton.imageScaling = .scaleProportionallyDown
|
|
|
+ colorbutton.target = self
|
|
|
+ colorbutton.action = #selector(colorButtonAction(_:))
|
|
|
+ customColorBox.addSubview(colorbutton)
|
|
|
+
|
|
|
+ self.setColor(color!)
|
|
|
+ }
|
|
|
+
|
|
|
+ // MARK: Public Method
|
|
|
+
|
|
|
+ func isChangeColor(_ color: NSColor?) -> Bool {
|
|
|
+ var hue: CGFloat = 0.0
|
|
|
+ var sa: CGFloat = 0.0
|
|
|
+ var bri: CGFloat = 0.0
|
|
|
+ var alpha: CGFloat = 0.0
|
|
|
+
|
|
|
+ if let color = color {
|
|
|
+ color.usingColorSpaceName(NSColorSpaceName.calibratedRGB)?.getHue(&hue, saturation: &sa, brightness: &bri, alpha: &alpha)
|
|
|
+ }
|
|
|
+
|
|
|
+ if (sa < 0.06 && bri > 0.25) || alpha < 0.15 {
|
|
|
+ return true
|
|
|
+ } else {
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ func isTheSameColor(_ color1: NSColor, anotherColor color2: NSColor) -> Bool {
|
|
|
+ let component = color1.cgColor.components
|
|
|
+ let component1 = color2.cgColor.components
|
|
|
+
|
|
|
+ guard let comp = component, let comp1 = component1 else {
|
|
|
+ // Handle the case where one or both colors don't have components
|
|
|
+ return false
|
|
|
+ }
|
|
|
+
|
|
|
+ if !compareSize(comp[0], comp1[0]) {
|
|
|
+ return false
|
|
|
+ }
|
|
|
+
|
|
|
+ if !compareSize(comp[1], comp1[1]) {
|
|
|
+ return false
|
|
|
+ }
|
|
|
+
|
|
|
+ if !compareSize(comp[2], comp1[2]) {
|
|
|
+ return false
|
|
|
+ }
|
|
|
+
|
|
|
+ if !compareSize(comp[3], comp1[3]) {
|
|
|
+ return false
|
|
|
+ }
|
|
|
+
|
|
|
+ return true
|
|
|
+ }
|
|
|
+
|
|
|
+ func compareSize(_ floa1: CGFloat, _ floa2: CGFloat) -> Bool {
|
|
|
+ let t1 = String(format: "%.3f", floa1).stringToCGFloat()
|
|
|
+ let t2 = String(format: "%.3f", floa2).stringToCGFloat()
|
|
|
+
|
|
|
+ if Int32(fabs(t1 - t2)) > Int32(1e-6) {
|
|
|
+ return false
|
|
|
+ }
|
|
|
+
|
|
|
+ return true
|
|
|
+ }
|
|
|
+
|
|
|
+ // MARK: Button Action
|
|
|
+
|
|
|
+ @objc func buttonAction(_ button: NSButton) {
|
|
|
+ NSColorPanel.shared.setTarget(nil)
|
|
|
+ updatingColor = true
|
|
|
+ let color = colors[button.tag]
|
|
|
+ self.color = color
|
|
|
+ target?.perform(self.action, with: self)
|
|
|
+ updatingColor = false
|
|
|
+ }
|
|
|
+
|
|
|
+ @objc func customColorButtonAction(_ sender: Any) {
|
|
|
+ self.color = customColor!
|
|
|
+ target?.perform(self.action, with: self)
|
|
|
+ }
|
|
|
+
|
|
|
+ @objc func colorButtonAction(_ sender: Any) {
|
|
|
+ if isCallColorPanelAction {
|
|
|
+ NSColorPanel.shared.setTarget(self)
|
|
|
+ NSColorPanel.shared.setAction(#selector(colorPanelAction(_:)))
|
|
|
+ }
|
|
|
+
|
|
|
+ if hideColorPanelAlpha {
|
|
|
+ NSColorPanel.shared.showsAlpha = false
|
|
|
+ } else {
|
|
|
+ NSColorPanel.shared.showsAlpha = true
|
|
|
+ }
|
|
|
+
|
|
|
+ if let accessoryView = NSColorPanel.shared.accessoryView as? NSButton {
|
|
|
+ if isFreeText {
|
|
|
+ accessoryView.state = isFillColor ? .off : .on
|
|
|
+ } else {
|
|
|
+ accessoryView.state = isFillColor ? .on : .off
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if isFillColor {
|
|
|
+ NSColorPanel.shared.orderFront(nil)
|
|
|
+ } else {
|
|
|
+ if isFreeText {
|
|
|
+ // NSFontPanel.shared.orderFront(nil)
|
|
|
+ NSColorPanel.shared.orderFront(nil)
|
|
|
+ } else {
|
|
|
+ NSColorPanel.shared.orderFront(nil)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @objc func colorPanelAction(_ sender: Any) {
|
|
|
+ self.color = NSColorPanel.shared.color
|
|
|
+ self.target?.perform(self.action, with: self)
|
|
|
+ }
|
|
|
+
|
|
|
+ @objc func menuItemChangeColorAction(_ sender: NSMenuItem) {
|
|
|
+ if let indexNumber = sender.representedObject as? NSNumber {
|
|
|
+ self.secterindex = indexNumber.intValue
|
|
|
+ NSColorPanel.shared.setTarget(self)
|
|
|
+ NSColorPanel.shared.setAction(#selector(menuItemPanelAction(_:)))
|
|
|
+ if let accessoryView = NSColorPanel.shared.accessoryView as? NSButton {
|
|
|
+ if self.isFreeText {
|
|
|
+ accessoryView.state = self.isFillColor ? .off : .on
|
|
|
+ } else {
|
|
|
+ accessoryView.state = self.isFillColor ? .on : .off
|
|
|
+ }
|
|
|
+ }
|
|
|
+ NSColorPanel.shared.orderFront(nil)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @objc func menuItemPanelAction(_ sender: Any) {
|
|
|
+ self.color = NSColorPanel.shared.color
|
|
|
+ self.target?.perform(self.action, with: self)
|
|
|
+
|
|
|
+ var tColors = self.colors
|
|
|
+ tColors[self.secterindex] = self.color!
|
|
|
+ self.colors = tColors
|
|
|
+
|
|
|
+ self.saveColors()
|
|
|
+ }
|
|
|
+
|
|
|
+ @objc func menuItemRestoreColorAction(_ sender: NSMenuItem) {
|
|
|
+ switch annotationType {
|
|
|
+ case .markupHighlightColors:
|
|
|
+ colors = KMAnnotationPropertiesColorManager.manager.markHighlightColors
|
|
|
+ case .markupOtherColors:
|
|
|
+ colors = KMAnnotationPropertiesColorManager.manager.markOtherColors
|
|
|
+ case .lineColors:
|
|
|
+ colors = KMAnnotationPropertiesColorManager.manager.lineColors
|
|
|
+ case .lineFillColors:
|
|
|
+ colors = KMAnnotationPropertiesColorManager.manager.fillLineColors
|
|
|
+ case .inkColors:
|
|
|
+ colors = KMAnnotationPropertiesColorManager.manager.inkColors
|
|
|
+ case .inkFillColors:
|
|
|
+ colors = KMAnnotationPropertiesColorManager.manager.inkFillColors
|
|
|
+ case .freeTextColors:
|
|
|
+ colors = KMAnnotationPropertiesColorManager.manager.freeTextColors
|
|
|
+ case .freeTextFillColors:
|
|
|
+ colors = KMAnnotationPropertiesColorManager.manager.freeFillTextColors
|
|
|
+ case .anchoredNoteColors:
|
|
|
+ colors = KMAnnotationPropertiesColorManager.manager.anchoredNoteColors
|
|
|
+ case .fromColors:
|
|
|
+ colors = KMAnnotationPropertiesColorManager.manager.fromColors
|
|
|
+ case .fromFillColors:
|
|
|
+ colors = KMAnnotationPropertiesColorManager.manager.fromFillColors
|
|
|
+ case .selfSignColors, .editText:
|
|
|
+ colors = KMAnnotationPropertiesColorManager.manager.selfSignColors
|
|
|
+ case .otherColors:
|
|
|
+ colors = KMAnnotationPropertiesColorManager.manager.otherColors
|
|
|
+ default:
|
|
|
+ break
|
|
|
+ }
|
|
|
+ saveColors()
|
|
|
+ }
|
|
|
+
|
|
|
+ func saveColors() {
|
|
|
+ switch annotationType {
|
|
|
+ case .markupHighlightColors:
|
|
|
+ KMAnnotationPropertiesColorManager.manager.markHighlightColors = colors
|
|
|
+ case .markupOtherColors:
|
|
|
+ KMAnnotationPropertiesColorManager.manager.markOtherColors = colors
|
|
|
+ case .lineColors:
|
|
|
+ KMAnnotationPropertiesColorManager.manager.lineColors = colors
|
|
|
+ case .lineFillColors:
|
|
|
+ KMAnnotationPropertiesColorManager.manager.fillLineColors = colors
|
|
|
+ case .inkColors:
|
|
|
+ KMAnnotationPropertiesColorManager.manager.inkColors = colors
|
|
|
+ case .inkFillColors:
|
|
|
+ KMAnnotationPropertiesColorManager.manager.inkFillColors = colors
|
|
|
+ case .freeTextColors:
|
|
|
+ KMAnnotationPropertiesColorManager.manager.freeTextColors = colors
|
|
|
+ case .freeTextFillColors:
|
|
|
+ KMAnnotationPropertiesColorManager.manager.freeFillTextColors = colors
|
|
|
+ case .anchoredNoteColors:
|
|
|
+ KMAnnotationPropertiesColorManager.manager.anchoredNoteColors = colors
|
|
|
+ case .fromColors:
|
|
|
+ KMAnnotationPropertiesColorManager.manager.fromColors = colors
|
|
|
+ case .fromFillColors:
|
|
|
+ KMAnnotationPropertiesColorManager.manager.fromFillColors = colors
|
|
|
+ case .selfSignColors, .editText: // Handling both cases for .selfSignColors and .editText
|
|
|
+ KMAnnotationPropertiesColorManager.manager.selfSignColors = colors
|
|
|
+ case .otherColors:
|
|
|
+ KMAnnotationPropertiesColorManager.manager.otherColors = colors
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|