making changes to align with comments.

This commit is contained in:
Kevin G Christiano 2019-10-03 11:14:16 -04:00
parent 61fcd981c1
commit 5d1c87819d

View File

@ -76,8 +76,21 @@ import MVMCore
/// Manages the appearance of the checkbox. /// Manages the appearance of the checkbox.
private var shapeLayer: CAShapeLayer? private var shapeLayer: CAShapeLayer?
public var checkWidth: CGFloat = 2 public var checkWidth: CGFloat = 2 {
public var checkColor: UIColor = .black didSet {
CATransaction.withDisabledAnimations {
shapeLayer?.lineWidth = checkWidth
}
}
}
public var checkColor: UIColor = .black {
didSet {
CATransaction.withDisabledAnimations {
shapeLayer?.strokeColor = checkColor.cgColor
}
}
}
public var borderWidth: CGFloat = 1 public var borderWidth: CGFloat = 1
public var borderColor: UIColor = .black public var borderColor: UIColor = .black
@ -93,7 +106,9 @@ import MVMCore
delegate.formValidatorModel?()?.enableByValidation() delegate.formValidatorModel?()?.enableByValidation()
} }
accessibilityLabel = MVMCoreUIUtility.hardcodedString(withKey: isSelected ? "checkbox_checked_state" : "checkbox_unchecked_state") if let state = MVMCoreUIUtility.hardcodedString(withKey: isSelected ? "checkbox_checked_state" : "checkbox_unchecked_state") {
accessibilityLabel = String(format: MVMCoreUIUtility.hardcodedString(withKey: "checkbox_desc_state") ?? "%@", state)
}
} }
} }
} }
@ -105,8 +120,11 @@ import MVMCore
override public init(frame: CGRect) { override public init(frame: CGRect) {
super.init(frame: frame) super.init(frame: frame)
accessibilityTraits = .none accessibilityTraits = .button
accessibilityHint = MVMCoreUIUtility.hardcodedString(withKey: "checkbox_action_hint") accessibilityHint = MVMCoreUIUtility.hardcodedString(withKey: "checkbox_action_hint")
if let state = MVMCoreUIUtility.hardcodedString(withKey: isSelected ? "checkbox_checked_state" : "checkbox_unchecked_state") {
accessibilityLabel = String(format: MVMCoreUIUtility.hardcodedString(withKey: "checkbox_desc_state") ?? "%@", state)
}
setupView() setupView()
} }
@ -276,6 +294,11 @@ import MVMCore
return x < -faultTolerance || y < -faultTolerance || x > widthLimit || y > heightLimt return x < -faultTolerance || y < -faultTolerance || x > widthLimit || y > heightLimt
} }
override open func accessibilityActivate() -> Bool {
sendActions(for: .touchUpInside)
return true
}
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Molecular // MARK: - Molecular
//-------------------------------------------------- //--------------------------------------------------