arrow color inversion
This commit is contained in:
parent
b83abf673e
commit
1a2d7b2abd
@ -41,8 +41,20 @@ open class Arrow: View {
|
||||
}
|
||||
|
||||
open var color: UIColor {
|
||||
get { return arrowModel?.color.uiColor ?? .mvmBlack }
|
||||
set { arrowModel?.color = Color(uiColor: newValue) }
|
||||
get {
|
||||
if let model = arrowModel, model.inverted {
|
||||
return arrowModel?.color_inverted.uiColor ?? .mvmWhite
|
||||
} else {
|
||||
return arrowModel?.color.uiColor ?? .mvmBlack
|
||||
}
|
||||
}
|
||||
set {
|
||||
if let model = arrowModel, model.inverted {
|
||||
arrowModel?.color_inverted = Color(uiColor: newValue)
|
||||
} else {
|
||||
arrowModel?.color = Color(uiColor: newValue)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
open var degrees: Float {
|
||||
|
||||
@ -22,11 +22,13 @@ open class ArrowModel: MoleculeModelProtocol {
|
||||
public var backgroundColor: Color?
|
||||
public var disabledColor: Color = Color(uiColor: .mvmCoolGray3)
|
||||
public var color: Color = Color(uiColor: .mvmBlack)
|
||||
public var color_inverted: Color = Color(uiColor: .mvmWhite)
|
||||
public var degrees: Float = 0
|
||||
public var lineWidth: CGFloat = 1
|
||||
public var height: CGFloat = 12
|
||||
public var width: CGFloat = 12
|
||||
public var enabled: Bool = true
|
||||
public var inverted: Bool = false
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - Enum
|
||||
@ -64,6 +66,7 @@ open class ArrowModel: MoleculeModelProtocol {
|
||||
case height
|
||||
case width
|
||||
case enabled
|
||||
case inverted
|
||||
}
|
||||
|
||||
//--------------------------------------------------
|
||||
@ -79,6 +82,10 @@ open class ArrowModel: MoleculeModelProtocol {
|
||||
self.disabledColor = disabledColor
|
||||
}
|
||||
|
||||
if let inverted = try typeContainer.decodeIfPresent(Bool.self, forKey: .inverted) {
|
||||
self.inverted = inverted
|
||||
}
|
||||
|
||||
if let color = try typeContainer.decodeIfPresent(Color.self, forKey: .color) {
|
||||
self.color = color
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user