Merge branch 'bugfix/CXTDT-420483-Checkbox' into refactor/checkbox
# Conflicts: # VDS/Components/Checkbox/Checkbox.swift Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
commit
d2faf40416
@ -111,7 +111,6 @@ 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() { }
|
||||||
|
|
||||||
|
|
||||||
@ -130,26 +129,11 @@ public class ControlColorConfiguration: KeyColorConfigurable {
|
|||||||
public func getColor(_ object: any ObjectType) -> UIColor {
|
public func getColor(_ object: any ObjectType) -> UIColor {
|
||||||
let state = object.state
|
let state = object.state
|
||||||
let surface = object.surface
|
let surface = object.surface
|
||||||
|
|
||||||
// find the exact match
|
|
||||||
if let keyColor = keyColors.first(where: {$0.key == state }) {
|
|
||||||
lastKeyColor = keyColor
|
|
||||||
return keyColor.surfaceConfig.getColor(surface)
|
|
||||||
|
|
||||||
} else if state.contains(.disabled), let keyColor = keyColors.first(where: {$0.key == .disabled }) {
|
if let keyColor = keyColors.first(where: {$0.key.isSubset(of: state) }) {
|
||||||
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 }) {
|
|
||||||
lastKeyColor = keyColor
|
|
||||||
return keyColor.surfaceConfig.getColor(surface)
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if let lastKeyColor {
|
return .clear
|
||||||
return lastKeyColor.surfaceConfig.getColor(surface)
|
|
||||||
} else {
|
|
||||||
return .clear
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user