story:ONEAPP-6315: made changes for selectedIconName, and selected state of buttonIcon
This commit is contained in:
parent
0c9a689e13
commit
960cf33b41
@ -75,7 +75,7 @@ open class ButtonIcon: Control {
|
|||||||
private var badgeIndicatorLeadingConstraint: NSLayoutConstraint?
|
private var badgeIndicatorLeadingConstraint: NSLayoutConstraint?
|
||||||
private var badgeIndicatorBottomConstraint: NSLayoutConstraint?
|
private var badgeIndicatorBottomConstraint: NSLayoutConstraint?
|
||||||
private var currentIconName: Icon.Name? {
|
private var currentIconName: Icon.Name? {
|
||||||
if let selectedIconName {
|
if let selectedIconName, selectable {
|
||||||
return selectedIconName
|
return selectedIconName
|
||||||
} else {
|
} else {
|
||||||
return iconName
|
return iconName
|
||||||
@ -120,7 +120,7 @@ open class ButtonIcon: Control {
|
|||||||
/// Icon Name used within the Icon.
|
/// Icon Name used within the Icon.
|
||||||
open var iconName: Icon.Name? { didSet { setNeedsUpdate() } }
|
open var iconName: Icon.Name? { didSet { setNeedsUpdate() } }
|
||||||
|
|
||||||
/// Icon Name used within the Icon within the Selected State.
|
/// Selected Icon Name used within the Icon if selectable true.
|
||||||
open var selectedIconName: Icon.Name? { didSet { setNeedsUpdate() } }
|
open var selectedIconName: Icon.Name? { didSet { setNeedsUpdate() } }
|
||||||
|
|
||||||
/// Sets the size of button icon and icon.
|
/// Sets the size of button icon and icon.
|
||||||
@ -141,7 +141,7 @@ open class ButtonIcon: Control {
|
|||||||
/// If provided, the badge indicator will present.
|
/// If provided, the badge indicator will present.
|
||||||
open var showBadgeIndicator: Bool = false { didSet { setNeedsUpdate() } }
|
open var showBadgeIndicator: Bool = false { didSet { setNeedsUpdate() } }
|
||||||
|
|
||||||
/// If provided, the button icon will have selectable Icon.
|
/// If true, button will be rendered as selected, when it is selectable.
|
||||||
open var selectable: Bool = false { didSet { setNeedsUpdate() } }
|
open var selectable: Bool = false { didSet { setNeedsUpdate() } }
|
||||||
|
|
||||||
/// Used to move the icon inside the button in both x and y axis.
|
/// Used to move the icon inside the button in both x and y axis.
|
||||||
@ -154,7 +154,7 @@ open class ButtonIcon: Control {
|
|||||||
// MARK: - Configuration
|
// MARK: - Configuration
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
private var iconColorConfiguration: AnyColorable {
|
private var iconColorConfiguration: AnyColorable {
|
||||||
if selectedIconName != nil {
|
if selectedIconName != nil, selectable {
|
||||||
return selectedIconColorConfiguration
|
return selectedIconColorConfiguration
|
||||||
} else {
|
} else {
|
||||||
if kind == .highContrast {
|
if kind == .highContrast {
|
||||||
@ -346,7 +346,7 @@ open class ButtonIcon: Control {
|
|||||||
hideBorder = true
|
hideBorder = true
|
||||||
iconOffset = .init(x: 0, y: 0)
|
iconOffset = .init(x: 0, y: 0)
|
||||||
iconName = nil
|
iconName = nil
|
||||||
// selectableIconName = nil
|
selectedIconName = nil
|
||||||
showBadgeIndicator = false
|
showBadgeIndicator = false
|
||||||
selectable = false
|
selectable = false
|
||||||
badgeIndicatorModel = nil
|
badgeIndicatorModel = nil
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user