enabled change + comments
This commit is contained in:
parent
4c57ff1450
commit
6386694ea5
@ -27,8 +27,11 @@ open class Arrow: View {
|
||||
|
||||
open var isEnabled: Bool = true {
|
||||
didSet {
|
||||
arrowModel?.enabled = isEnabled
|
||||
isUserInteractionEnabled = isEnabled
|
||||
setNeedsDisplay()
|
||||
if isEnabled != oldValue {
|
||||
setNeedsDisplay()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -56,6 +59,7 @@ open class Arrow: View {
|
||||
// MARK: - Enum
|
||||
//--------------------------------------------------
|
||||
|
||||
/// Conveniece for readability of arrow pointing direction.
|
||||
public enum Direction: Float {
|
||||
case right = 0
|
||||
case upperRight = 45
|
||||
@ -164,4 +168,12 @@ open class Arrow: View {
|
||||
|
||||
return bezierPath.cgPath
|
||||
}
|
||||
|
||||
public override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||
super.set(with: model, delegateObject, additionalData)
|
||||
|
||||
guard let model = model as? ArrowModel else { return }
|
||||
|
||||
isEnabled = model.enabled
|
||||
}
|
||||
}
|
||||
|
||||
@ -26,7 +26,7 @@ open class ArrowModel: MoleculeModelProtocol {
|
||||
public var lineWidth: CGFloat = 1
|
||||
public var height: CGFloat = 12
|
||||
public var width: CGFloat = 12
|
||||
public var isEnabled: Bool = true
|
||||
public var enabled: Bool = true
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - Initializer
|
||||
@ -47,7 +47,7 @@ open class ArrowModel: MoleculeModelProtocol {
|
||||
case lineWidth
|
||||
case height
|
||||
case width
|
||||
case isEnabled
|
||||
case enabled
|
||||
}
|
||||
|
||||
//--------------------------------------------------
|
||||
@ -67,8 +67,8 @@ open class ArrowModel: MoleculeModelProtocol {
|
||||
self.color = color
|
||||
}
|
||||
|
||||
if let isEnabled = try typeContainer.decodeIfPresent(Bool.self, forKey: .isEnabled) {
|
||||
self.isEnabled = isEnabled
|
||||
if let enabled = try typeContainer.decodeIfPresent(Bool.self, forKey: .enabled) {
|
||||
self.enabled = enabled
|
||||
}
|
||||
|
||||
if let degrees = try typeContainer.decodeIfPresent(Float.self, forKey: .degrees) {
|
||||
@ -98,6 +98,6 @@ open class ArrowModel: MoleculeModelProtocol {
|
||||
try container.encode(lineWidth, forKey: .lineWidth)
|
||||
try container.encode(width, forKey: .width)
|
||||
try container.encode(height, forKey: .height)
|
||||
try container.encode(isEnabled, forKey: .isEnabled)
|
||||
try container.encode(enabled, forKey: .enabled)
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user