Merge branch 'bugfix/correct_toggle' into 'develop'
correct toggle See merge request BPHV_MIPS/mvm_core_ui!512
This commit is contained in:
commit
f2c5f9d043
@ -62,8 +62,7 @@ public typealias ActionBlockConfirmation = () -> (Bool)
|
|||||||
didSet {
|
didSet {
|
||||||
isUserInteractionEnabled = isEnabled
|
isUserInteractionEnabled = isEnabled
|
||||||
changeStateNoAnimation(isEnabled ? isOn : false)
|
changeStateNoAnimation(isEnabled ? isOn : false)
|
||||||
backgroundColor = isEnabled ? (isOn ? containerTintColor.on : containerTintColor.off) : disabledTintColor.container
|
setToggleAppearanceFromState()
|
||||||
knobView.backgroundColor = isEnabled ? (isOn ? knobTintColor.on : knobTintColor.off) : disabledTintColor.knob
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -96,8 +95,7 @@ public typealias ActionBlockConfirmation = () -> (Bool)
|
|||||||
}, completion: nil)
|
}, completion: nil)
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
backgroundColor = isOn ? containerTintColor.on : containerTintColor.off
|
setToggleAppearanceFromState()
|
||||||
knobView.backgroundColor = isOn ? knobTintColor.on : knobTintColor.off
|
|
||||||
self.constrainKnob()
|
self.constrainKnob()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -350,6 +348,12 @@ public typealias ActionBlockConfirmation = () -> (Bool)
|
|||||||
// MARK: - Animations
|
// MARK: - Animations
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
|
public func setToggleAppearanceFromState() {
|
||||||
|
|
||||||
|
backgroundColor = isEnabled ? isOn ? containerTintColor.on : containerTintColor.off : disabledTintColor.container
|
||||||
|
knobView.backgroundColor = isEnabled ? isOn ? knobTintColor.on : knobTintColor.off : disabledTintColor.knob
|
||||||
|
}
|
||||||
|
|
||||||
public func knobReformAnimation() {
|
public func knobReformAnimation() {
|
||||||
|
|
||||||
if isAnimated {
|
if isAnimated {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user