fixed issue in control configuration
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
814c71fbe7
commit
38aff5a637
@ -81,7 +81,7 @@ public class ControlColorConfiguration: KeyColorConfigurable {
|
|||||||
public typealias KeyType = UIControl.State
|
public typealias KeyType = UIControl.State
|
||||||
public typealias ObjectType = Surfaceable & UIControl
|
public typealias ObjectType = Surfaceable & UIControl
|
||||||
public var keyColors: [KeyColorConfiguration<KeyType>] = []
|
public var keyColors: [KeyColorConfiguration<KeyType>] = []
|
||||||
|
private var lastKeyColor: KeyColorConfiguration<KeyType>?
|
||||||
public required init() { }
|
public required init() { }
|
||||||
|
|
||||||
public func setSurfaceColors(_ lightColor: UIColor, _ darkColor: UIColor, forState state: KeyType) {
|
public func setSurfaceColors(_ lightColor: UIColor, _ darkColor: UIColor, forState state: KeyType) {
|
||||||
@ -94,16 +94,23 @@ public class ControlColorConfiguration: KeyColorConfigurable {
|
|||||||
|
|
||||||
// find the exact match
|
// find the exact match
|
||||||
if let keyColor = keyColors.first(where: {$0.key == state }) {
|
if let keyColor = keyColors.first(where: {$0.key == state }) {
|
||||||
|
lastKeyColor = keyColor
|
||||||
return keyColor.surfaceConfig.getColor(surface)
|
return keyColor.surfaceConfig.getColor(surface)
|
||||||
|
|
||||||
} else if state.contains(.disabled), let keyColor = keyColors.first(where: {$0.key == .disabled }) {
|
} else if state.contains(.disabled), let keyColor = keyColors.first(where: {$0.key == .disabled }) {
|
||||||
|
lastKeyColor = keyColor
|
||||||
return keyColor.surfaceConfig.getColor(surface)
|
return keyColor.surfaceConfig.getColor(surface)
|
||||||
|
|
||||||
} else if state.contains(.highlighted), let keyColor = keyColors.first(where: {$0.key == .highlighted }) {
|
} else if state.contains(.highlighted), let keyColor = keyColors.first(where: {$0.key == .highlighted }) {
|
||||||
|
lastKeyColor = keyColor
|
||||||
return keyColor.surfaceConfig.getColor(surface)
|
return keyColor.surfaceConfig.getColor(surface)
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
return .clear
|
if let lastKeyColor {
|
||||||
|
return lastKeyColor.surfaceConfig.getColor(surface)
|
||||||
|
} else {
|
||||||
|
return .clear
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user