Commit 1cfbad4a by Daniel Dahan

development: adjusted rotation MotionTransition to snapshot the current state.

parent 1c53b32f
...@@ -32,10 +32,14 @@ import UIKit ...@@ -32,10 +32,14 @@ import UIKit
extension UIFont { extension UIFont {
/** /**
:name: stringSize Calculates a CGSize value based on a width and length of a string with a
*/ given UIFont.
open func stringSize(string: String, constrainedToWidth width: Double) -> CGSize { - Parameter string: A String.
return string.boundingRect(with: CGSize(width: width, height: DBL_MAX), - 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, options: NSStringDrawingOptions.usesLineFragmentOrigin,
attributes: [NSFontAttributeName: self], attributes: [NSFontAttributeName: self],
context: nil).size context: nil).size
......
...@@ -378,13 +378,8 @@ open class MotionTransitionPresentedAnimator: MotionTransitionAnimator { ...@@ -378,13 +378,8 @@ open class MotionTransitionPresentedAnimator: MotionTransitionAnimator {
let rotateAnimation = Motion.rotate(angle: toView.layer.value(forKeyPath: MotionAnimationKeyPath.rotation.rawValue) as? CGFloat ?? 0) 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 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) let cornerRadiusAnimation = Motion.corner(radius: toView.cornerRadius)
snapshotAnimations.append(cornerRadiusAnimation) snapshotAnimations.append(cornerRadiusAnimation)
snapshotChildAnimations.append(cornerRadiusAnimation) snapshotChildAnimations.append(cornerRadiusAnimation)
...@@ -499,9 +494,7 @@ open class MotionTransitionDismissedAnimator: MotionTransitionAnimator { ...@@ -499,9 +494,7 @@ open class MotionTransitionDismissedAnimator: MotionTransitionAnimator {
let rotateAnimation = Motion.rotate(angle: toView.layer.value(forKeyPath: MotionAnimationKeyPath.rotation.rawValue) as? CGFloat ?? 0) 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 rotateAnimation.fromValue = fromView.layer.value(forKeyPath: MotionAnimationKeyPath.rotation.rawValue) as? CGFloat ?? 0
snapshotChildAnimations.append(rotateAnimation) snapshotAnimations.append(rotateAnimation)
snapshotChildAnimations.append(Motion.background(color: toView.backgroundColor ?? .clear))
let cornerRadiusAnimation = Motion.corner(radius: toView.cornerRadius) let cornerRadiusAnimation = Motion.corner(radius: toView.cornerRadius)
snapshotAnimations.append(cornerRadiusAnimation) 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