Commit 0a2a3869 by Daniel Dahan

development: added border color, border width, and updated text inset merge

parent 4309c160
......@@ -546,6 +546,8 @@ extension MotionAnimator {
snapshotAnimations.append(Motion.position(to: to.motionPosition))
snapshotAnimations.append(Motion.transform(transform: to.motionTransform))
snapshotAnimations.append(Motion.background(color: to.backgroundColor ?? .clear))
snapshotAnimations.append(Motion.border(color: to.borderColor ?? .clear))
snapshotAnimations.append(Motion.border(width: to.borderWidth))
if let path = to.layer.shadowPath {
let shadowPath = Motion.shadow(path: path)
......
......@@ -33,6 +33,8 @@ import UIKit
public enum MotionAnimationKeyPath: String {
case backgroundColor
case barTintColor
case borderColor
case borderWidth
case cornerRadius
case transform
case rotation = "transform.rotation"
......@@ -66,6 +68,8 @@ public enum MotionAnimation {
case custom(CABasicAnimation)
case backgroundColor(UIColor)
case barTintColor(UIColor)
case borderColor(UIColor)
case borderWidth(CGFloat)
case cornerRadius(CGFloat)
case transform(CATransform3D)
case rotationAngle(CGFloat)
......@@ -264,6 +268,10 @@ extension CALayer {
a.append(Motion.background(color: color))
case let .barTintColor(color):
a.append(Motion.barTint(color: color))
case let .borderColor(color):
a.append(Motion.border(color: color))
case let .borderWidth(width):
a.append(Motion.border(width: width))
case let .cornerRadius(radius):
a.append(Motion.corner(radius: radius))
case let .transform(transform):
......@@ -478,6 +486,28 @@ extension Motion {
}
/**
Creates a CABasicAnimation for the borderColor key path.
- Parameter color: A UIColor.
- Returns: A CABasicAnimation.
*/
public static func border(color: UIColor) -> CABasicAnimation {
let animation = CABasicAnimation(keyPath: .borderColor)
animation.toValue = color.cgColor
return animation
}
/**
Creates a CABasicAnimation for the borderWidth key path.
- Parameter width: A CGFloat.
- Returns: A CABasicAnimation.
*/
public static func border(width: CGFloat) -> CABasicAnimation {
let animation = CABasicAnimation(keyPath: .borderWidth)
animation.toValue = width
return animation
}
/**
Creates a CABasicAnimation for the cornerRadius key path.
- Parameter radius: A CGFloat.
- Returns: A CABasicAnimation.
......
......@@ -387,10 +387,10 @@ open class TextField: UITextField {
return super.becomeFirstResponder()
}
/// EdgeInsets for text.
open var textInset: CGFloat = 0
open override func textRect(forBounds bounds: CGRect) -> CGRect {
return bounds.insetBy(dx: textInset, dy: 0)
}
......
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