Commit 1cfbad4a by Daniel Dahan

development: adjusted rotation MotionTransition to snapshot the current state.

parent 1c53b32f
......@@ -32,10 +32,14 @@ import UIKit
extension UIFont {
/**
:name: stringSize
*/
open func stringSize(string: String, constrainedToWidth width: Double) -> CGSize {
return string.boundingRect(with: CGSize(width: width, height: DBL_MAX),
Calculates a CGSize value based on a width and length of a string with a
given UIFont.
- Parameter string: A String.
- Parameter constrainedTo width: A CGFloat.
- Returns a CGSize.
*/
open func stringSize(string: String, constrainedTo width: CGFloat) -> CGSize {
return string.boundingRect(with: CGSize(width: width, height: CGFloat(DBL_MAX)),
options: NSStringDrawingOptions.usesLineFragmentOrigin,
attributes: [NSFontAttributeName: self],
context: nil).size
......
......@@ -378,13 +378,8 @@ open class MotionTransitionPresentedAnimator: MotionTransitionAnimator {
let rotateAnimation = Motion.rotate(angle: toView.layer.value(forKeyPath: MotionAnimationKeyPath.rotation.rawValue) as? CGFloat ?? 0)
rotateAnimation.fromValue = fromView.layer.value(forKeyPath: MotionAnimationKeyPath.rotation.rawValue) as? CGFloat ?? 0
snapshotChildAnimations.append(rotateAnimation)
snapshotAnimations.append(rotateAnimation)
// let backgroundColorAnimation = Motion.background(color: toView.backgroundColor ?? .clear)
// backgroundColorAnimation.fromValue = fromView.backgroundColor?.cgColor
// snapshotAnimations.append(backgroundColorAnimation)
// snapshotChildAnimations.append(backgroundColorAnimation)
//
let cornerRadiusAnimation = Motion.corner(radius: toView.cornerRadius)
snapshotAnimations.append(cornerRadiusAnimation)
snapshotChildAnimations.append(cornerRadiusAnimation)
......@@ -499,9 +494,7 @@ open class MotionTransitionDismissedAnimator: MotionTransitionAnimator {
let rotateAnimation = Motion.rotate(angle: toView.layer.value(forKeyPath: MotionAnimationKeyPath.rotation.rawValue) as? CGFloat ?? 0)
rotateAnimation.fromValue = fromView.layer.value(forKeyPath: MotionAnimationKeyPath.rotation.rawValue) as? CGFloat ?? 0
snapshotChildAnimations.append(rotateAnimation)
snapshotChildAnimations.append(Motion.background(color: toView.backgroundColor ?? .clear))
snapshotAnimations.append(rotateAnimation)
let cornerRadiusAnimation = Motion.corner(radius: toView.cornerRadius)
snapshotAnimations.append(cornerRadiusAnimation)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment