added canHighlight
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
0f8ab50192
commit
3ca168a53b
@ -52,7 +52,10 @@ open class Control: UIControl, ViewProtocol, UserInfoable, Clickable {
|
||||
|
||||
/// Whether the Control is selected or not.
|
||||
open override var isSelected: Bool { didSet { setNeedsUpdate() } }
|
||||
|
||||
|
||||
/// Whether the Control can handle the isHighlighted state.
|
||||
open var canHighlight: Bool = true
|
||||
|
||||
open var touchUpInsideCount: Int = 0
|
||||
|
||||
var isHighlightAnimating = false
|
||||
@ -60,7 +63,7 @@ open class Control: UIControl, ViewProtocol, UserInfoable, Clickable {
|
||||
/// Whether the Control is highlighted or not..
|
||||
open override var isHighlighted: Bool {
|
||||
didSet {
|
||||
if isHighlightAnimating == false && touchUpInsideCount > 0 {
|
||||
if canHighlight && isHighlightAnimating == false && touchUpInsideCount > 0 {
|
||||
isHighlightAnimating = true
|
||||
UIView.animate(withDuration: 0.1, animations: { [weak self] in
|
||||
self?.setNeedsUpdate()
|
||||
|
||||
@ -124,6 +124,9 @@ extension Tabs {
|
||||
|
||||
open override func setup() {
|
||||
super.setup()
|
||||
|
||||
canHighlight = false
|
||||
|
||||
addLayoutGuide(layoutGuide)
|
||||
addSubview(label)
|
||||
accessibilityTraits = .button
|
||||
|
||||
@ -140,7 +140,8 @@ open class Toggle: Control, Changeable {
|
||||
|
||||
open override func setup() {
|
||||
super.setup()
|
||||
|
||||
|
||||
canHighlight = false
|
||||
isAccessibilityElement = true
|
||||
accessibilityTraits = .button
|
||||
addSubview(label)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user