Included reset function. accounted for isAnimated state when changing isOn without animations.
This commit is contained in:
parent
639330ad5b
commit
39b752d01b
@ -220,6 +220,18 @@ public typealias ActionBlockConfirmation = () -> (Bool)
|
||||
accessibilityLabel = MVMCoreUIUtility.hardcodedString(withKey: "Toggle_buttonlabel")
|
||||
}
|
||||
|
||||
public override func reset() {
|
||||
super.reset()
|
||||
|
||||
backgroundColor = containerTintColor?.off
|
||||
knobView.backgroundColor = knobTintColor?.off
|
||||
isAnimated = false
|
||||
isOn = false
|
||||
constrainKnob()
|
||||
didToggleAction = nil
|
||||
shouldToggleAction = { return true }
|
||||
}
|
||||
|
||||
class func getContainerWidth() -> CGFloat {
|
||||
let containerWidth = Toggle.containerSize.width
|
||||
return (MFSizeObject(standardSize: containerWidth, standardiPadPortraitSize: CGFloat(Toggle.containerSize.width * 1.5)))?.getValueBasedOnApplicationWidth() ?? containerWidth
|
||||
@ -265,9 +277,12 @@ public typealias ActionBlockConfirmation = () -> (Bool)
|
||||
|
||||
private func changeStateNoAnimation(_ state: Bool) {
|
||||
|
||||
// Hold state in case User wanted isAnimated to remain off.
|
||||
let isAnimatedState = isAnimated
|
||||
|
||||
isAnimated = false
|
||||
isOn = state
|
||||
isAnimated = true
|
||||
isAnimated = isAnimatedState
|
||||
}
|
||||
|
||||
//--------------------------------------------------
|
||||
|
||||
Loading…
Reference in New Issue
Block a user