Commit 402084c6 by Daniel Dahan

development: fixed issue that when view was rotated it would not calculate the…

development: fixed issue that when view was rotated it would not calculate the cornerRadius correctly
parent 5930fa6f
......@@ -258,12 +258,10 @@ extension CALayer {
- Parameter animation: A CAAnimation instance.
*/
open func animate(animation: CAAnimation) {
if #available(iOS 10, *) {
animation.delegate = self
}
if let a = animation as? CABasicAnimation {
a.fromValue = (nil == presentation() ? self : presentation()!).value(forKeyPath: a.keyPath!)
a.fromValue = (presentation() ?? self).value(forKeyPath: a.keyPath!)
}
if let a = animation as? CAPropertyAnimation {
......@@ -320,7 +318,7 @@ extension CALayer {
}
if .circle == shapePreset {
cornerRadius = width / 2
cornerRadius = bounds.size.width / 2
}
}
......@@ -343,6 +341,4 @@ extension CALayer {
}
@available(iOS 10, *)
extension CALayer: CAAnimationDelegate {
}
extension CALayer: CAAnimationDelegate {}
......@@ -185,9 +185,9 @@ extension Motion {
public static func rotateY(angle: CGFloat? = nil, rotation: CGFloat? = nil, duration: CFTimeInterval? = nil) -> CABasicAnimation {
let animation = CABasicAnimation(keyPath: .rotationY)
if let v: CGFloat = angle {
if let v = angle {
animation.toValue = (CGFloat(M_PI) * v / 180) as NSNumber
} else if let v: CGFloat = rotation {
} else if let v = rotation {
animation.toValue = (CGFloat(M_PI * 2) * v) as NSNumber
}
......@@ -212,9 +212,9 @@ extension Motion {
public static func rotateZ(angle: CGFloat? = nil, rotation: CGFloat? = nil, duration: CFTimeInterval? = nil) -> CABasicAnimation {
let animation = CABasicAnimation(keyPath: .rotationZ)
if let v: CGFloat = angle {
if let v = angle {
animation.toValue = (CGFloat(M_PI) * v / 180) as NSNumber
} else if let v: CGFloat = rotation {
} else if let v = rotation {
animation.toValue = (CGFloat(M_PI * 2) * v) as NSNumber
}
......
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