upddate animations
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
669c2b15b5
commit
d7beea240c
@ -328,22 +328,18 @@ import Combine
|
|||||||
}
|
}
|
||||||
|
|
||||||
public override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) {
|
public override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) {
|
||||||
|
print("touchesEnded")
|
||||||
knobReformAnimation()
|
knobReformAnimation()
|
||||||
|
|
||||||
// Action only occurs of the user lifts up from withing acceptable region of the toggle.
|
// Action only occurs of the user lifts up from withing acceptable region of the toggle.
|
||||||
guard let coordinates = touches.first?.location(in: self),
|
let value = 20.0
|
||||||
coordinates.x > -20,
|
guard let coordinates = touches.first?.location(in: self) else { return }
|
||||||
coordinates.x < bounds.width + 20,
|
guard coordinates.x > -value else { return }
|
||||||
coordinates.y > -20,
|
|
||||||
coordinates.y < bounds.height + 20
|
|
||||||
else { return }
|
|
||||||
|
|
||||||
sendActions(for: .touchUpInside)
|
sendActions(for: .touchUpInside)
|
||||||
}
|
}
|
||||||
|
|
||||||
public func touchesCancelled(_ touches: Set<UITouch>, with event: UIEvent) {
|
open override func touchesCancelled(_ touches: Set<UITouch>, with event: UIEvent?) {
|
||||||
|
print("touchesCancelled")
|
||||||
knobReformAnimation()
|
knobReformAnimation()
|
||||||
sendActions(for: .touchCancel)
|
sendActions(for: .touchCancel)
|
||||||
}
|
}
|
||||||
@ -400,7 +396,7 @@ import Combine
|
|||||||
self.knobView.backgroundColor = viewModel.on ? knobColor.on : knobColor.off
|
self.knobView.backgroundColor = viewModel.on ? knobColor.on : knobColor.off
|
||||||
}, completion: nil)
|
}, completion: nil)
|
||||||
|
|
||||||
UIView.animate(withDuration: 0.33, delay: 0, usingSpringWithDamping: 0.6, initialSpringVelocity: 0.2, options: [], animations: {
|
UIView.animate(withDuration: 0.33, delay: 0, usingSpringWithDamping: 0.7, initialSpringVelocity: 0.5, options: [], animations: {
|
||||||
constrainKnob()
|
constrainKnob()
|
||||||
}, completion: nil)
|
}, completion: nil)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user