Commit 6f3a9732 by Daniel Dahan

updated MaterialLayer and Material*Views internal animation logic

parent d8da014e
...@@ -417,4 +417,4 @@ public class BasicCardView : MaterialPulseView { ...@@ -417,4 +417,4 @@ public class BasicCardView : MaterialPulseView {
self.leftButtons = leftButtons self.leftButtons = leftButtons
self.rightButtons = rightButtons self.rightButtons = rightButtons
} }
} }
\ No newline at end of file
...@@ -345,6 +345,8 @@ public class ImageCardView : MaterialPulseView { ...@@ -345,6 +345,8 @@ public class ImageCardView : MaterialPulseView {
borderWidth = MaterialTheme.imageCardView.borderWidth borderWidth = MaterialTheme.imageCardView.borderWidth
borderColor = MaterialTheme.imageCardView.bordercolor borderColor = MaterialTheme.imageCardView.bordercolor
dividerColor = MaterialTheme.imageCardView.dividerColor dividerColor = MaterialTheme.imageCardView.dividerColor
visualLayer.masksToBounds = true
} }
/** /**
...@@ -491,7 +493,7 @@ public class ImageCardView : MaterialPulseView { ...@@ -491,7 +493,7 @@ public class ImageCardView : MaterialPulseView {
internal func prepareImageLayer() { internal func prepareImageLayer() {
imageLayer = CAShapeLayer() imageLayer = CAShapeLayer()
imageLayer.zPosition = 0 imageLayer.zPosition = 0
materialLayer.visualLayer.addSublayer(imageLayer) visualLayer.addSublayer(imageLayer)
} }
// //
...@@ -517,4 +519,4 @@ public class ImageCardView : MaterialPulseView { ...@@ -517,4 +519,4 @@ public class ImageCardView : MaterialPulseView {
self.leftButtons = leftButtons self.leftButtons = leftButtons
self.rightButtons = rightButtons self.rightButtons = rightButtons
} }
} }
\ No newline at end of file
...@@ -21,20 +21,6 @@ import UIKit ...@@ -21,20 +21,6 @@ import UIKit
@objc(MaterialButton) @objc(MaterialButton)
public class MaterialButton : UIButton { public class MaterialButton : UIButton {
/** /**
:name: layerClass
*/
public override class func layerClass() -> AnyClass {
return MaterialLayer.self
}
/**
:name: materialLayer
*/
public var materialLayer: MaterialLayer {
return layer as! MaterialLayer
}
/**
:name: visualLayer :name: visualLayer
*/ */
public private(set) lazy var visualLayer: CAShapeLayer = CAShapeLayer() public private(set) lazy var visualLayer: CAShapeLayer = CAShapeLayer()
...@@ -47,14 +33,7 @@ public class MaterialButton : UIButton { ...@@ -47,14 +33,7 @@ public class MaterialButton : UIButton {
/** /**
:name: delegate :name: delegate
*/ */
public weak var delegate: MaterialAnimationDelegate? { public weak var delegate: MaterialAnimationDelegate?
get {
return materialLayer.animationDelegate
}
set(value) {
materialLayer.animationDelegate = delegate
}
}
/** /**
:name: pulseScale :name: pulseScale
...@@ -102,23 +81,11 @@ public class MaterialButton : UIButton { ...@@ -102,23 +81,11 @@ public class MaterialButton : UIButton {
} }
/** /**
:name: masksToBounds
*/
public var masksToBounds: Bool {
get {
return materialLayer.masksToBounds
}
set(value) {
materialLayer.masksToBounds = value
}
}
/**
:name: backgroundColor :name: backgroundColor
*/ */
public override var backgroundColor: UIColor? { public override var backgroundColor: UIColor? {
didSet { didSet {
materialLayer.backgroundColor = backgroundColor?.CGColor layer.backgroundColor = backgroundColor?.CGColor
} }
} }
...@@ -127,10 +94,10 @@ public class MaterialButton : UIButton { ...@@ -127,10 +94,10 @@ public class MaterialButton : UIButton {
*/ */
public var x: CGFloat { public var x: CGFloat {
get { get {
return materialLayer.x return frame.origin.x
} }
set(value) { set(value) {
materialLayer.x = value frame.origin.x = value
} }
} }
...@@ -139,10 +106,10 @@ public class MaterialButton : UIButton { ...@@ -139,10 +106,10 @@ public class MaterialButton : UIButton {
*/ */
public var y: CGFloat { public var y: CGFloat {
get { get {
return materialLayer.y return frame.origin.y
} }
set(value) { set(value) {
materialLayer.y = value frame.origin.y = value
} }
} }
...@@ -151,10 +118,13 @@ public class MaterialButton : UIButton { ...@@ -151,10 +118,13 @@ public class MaterialButton : UIButton {
*/ */
public var width: CGFloat { public var width: CGFloat {
get { get {
return materialLayer.width return frame.size.width
} }
set(value) { set(value) {
materialLayer.width = value frame.size.width = value
if .None != shape {
frame.size.height = value
}
} }
} }
...@@ -163,10 +133,13 @@ public class MaterialButton : UIButton { ...@@ -163,10 +133,13 @@ public class MaterialButton : UIButton {
*/ */
public var height: CGFloat { public var height: CGFloat {
get { get {
return materialLayer.height return frame.size.height
} }
set(value) { set(value) {
materialLayer.height = value frame.size.height = value
if .None != shape {
frame.size.width = value
}
} }
} }
...@@ -216,11 +189,28 @@ public class MaterialButton : UIButton { ...@@ -216,11 +189,28 @@ public class MaterialButton : UIButton {
} }
/** /**
:name: masksToBounds
*/
public var masksToBounds: Bool {
get {
return visualLayer.masksToBounds
}
set(value) {
visualLayer.masksToBounds = value
}
}
/**
:name: cornerRadius :name: cornerRadius
*/ */
public var cornerRadius: MaterialRadius { public var cornerRadius: MaterialRadius? {
didSet { didSet {
materialLayer.cornerRadius = MaterialRadiusToValue(cornerRadius) if let v: MaterialRadius = cornerRadius {
layer.cornerRadius = MaterialRadiusToValue(v)
if .Circle == shape {
shape = .None
}
}
} }
} }
...@@ -231,9 +221,9 @@ public class MaterialButton : UIButton { ...@@ -231,9 +221,9 @@ public class MaterialButton : UIButton {
didSet { didSet {
if .None != shape { if .None != shape {
if width < height { if width < height {
width = height frame.size.width = height
} else { } else {
height = width frame.size.height = width
} }
} }
} }
...@@ -244,7 +234,7 @@ public class MaterialButton : UIButton { ...@@ -244,7 +234,7 @@ public class MaterialButton : UIButton {
*/ */
public var borderWidth: MaterialBorder { public var borderWidth: MaterialBorder {
didSet { didSet {
materialLayer.borderWidth = MaterialBorderToValue(borderWidth) layer.borderWidth = MaterialBorderToValue(borderWidth)
} }
} }
...@@ -253,7 +243,7 @@ public class MaterialButton : UIButton { ...@@ -253,7 +243,7 @@ public class MaterialButton : UIButton {
*/ */
public var borderColor: UIColor? { public var borderColor: UIColor? {
didSet { didSet {
materialLayer.borderColor = borderColor?.CGColor layer.borderColor = borderColor?.CGColor
} }
} }
...@@ -311,7 +301,6 @@ public class MaterialButton : UIButton { ...@@ -311,7 +301,6 @@ public class MaterialButton : UIButton {
shadowDepth = .None shadowDepth = .None
shape = .None shape = .None
contentInsets = .None contentInsets = .None
cornerRadius = .None
super.init(coder: aDecoder) super.init(coder: aDecoder)
} }
...@@ -323,33 +312,69 @@ public class MaterialButton : UIButton { ...@@ -323,33 +312,69 @@ public class MaterialButton : UIButton {
shadowDepth = .None shadowDepth = .None
shape = .None shape = .None
contentInsets = .None contentInsets = .None
cornerRadius = .None
super.init(frame: frame) super.init(frame: frame)
prepareView() prepareView()
} }
/** /**
:name: layoutSublayersOfLayer :name: init
*/ */
public override func layoutSublayersOfLayer(layer: CALayer) { public convenience init() {
super.layoutSublayersOfLayer(layer) self.init(frame: CGRectNull)
if self.layer == layer {
prepareShape()
}
} }
/** /**
:name: init :name: layoutSubviews
*/ */
public convenience init() { public override func layoutSubviews() {
self.init(frame: CGRectNull) super.layoutSubviews()
prepareShape()
visualLayer.frame = bounds
visualLayer.position = CGPointMake(width / 2, height / 2)
visualLayer.cornerRadius = layer.cornerRadius
} }
/** /**
:name: animation :name: animation
*/ */
public func animation(animation: CAAnimation) { public func animation(animation: CAAnimation) {
materialLayer.animation(animation) animation.delegate = self
if let a: CABasicAnimation = animation as? CABasicAnimation {
a.fromValue = (nil == layer.presentationLayer() ? layer : layer.presentationLayer() as! CALayer).valueForKeyPath(a.keyPath!)
}
if let a: CAPropertyAnimation = animation as? CAPropertyAnimation {
layer.addAnimation(a, forKey: a.keyPath!)
} else if let a: CAAnimationGroup = animation as? CAAnimationGroup {
layer.addAnimation(a, forKey: nil)
} else if let a: CATransition = animation as? CATransition {
layer.addAnimation(a, forKey: kCATransition)
}
}
/**
:name: animationDidStart
*/
public override func animationDidStart(anim: CAAnimation) {
delegate?.materialAnimationDidStart?(anim)
}
/**
:name: animationDidStop
*/
public override func animationDidStop(anim: CAAnimation, finished flag: Bool) {
if let a: CAPropertyAnimation = anim as? CAPropertyAnimation {
if let b: CABasicAnimation = a as? CABasicAnimation {
MaterialAnimation.animationDisabled({
self.layer.setValue(nil == b.toValue ? b.byValue : b.toValue, forKey: b.keyPath!)
})
}
delegate?.materialAnimationDidStop?(anim, finished: flag)
layer.removeAnimationForKey(a.keyPath!)
} else if let a: CAAnimationGroup = anim as? CAAnimationGroup {
for x in a.animations! {
animationDidStop(x, finished: true)
}
}
} }
/** /**
...@@ -414,11 +439,24 @@ public class MaterialButton : UIButton { ...@@ -414,11 +439,24 @@ public class MaterialButton : UIButton {
} }
/** /**
:name: actionForLayer
*/
public override func actionForLayer(layer: CALayer, forKey event: String) -> CAAction? {
return nil // returning nil enables the animations for the layer property that are normally disabled.
}
/**
:name: prepareView :name: prepareView
*/ */
public func prepareView() { public func prepareView() {
// visualLayer
visualLayer.zPosition = -1
layer.addSublayer(visualLayer)
// pulseLayer // pulseLayer
materialLayer.visualLayer.addSublayer(pulseLayer) pulseLayer.hidden = true
pulseLayer.zPosition = 1
visualLayer.addSublayer(pulseLayer)
} }
// //
...@@ -426,7 +464,7 @@ public class MaterialButton : UIButton { ...@@ -426,7 +464,7 @@ public class MaterialButton : UIButton {
// //
internal func prepareShape() { internal func prepareShape() {
if .Circle == shape { if .Circle == shape {
materialLayer.cornerRadius = width / 2 layer.cornerRadius = width / 2
} }
} }
......
...@@ -131,6 +131,13 @@ public class MaterialPulseView : MaterialView { ...@@ -131,6 +131,13 @@ public class MaterialPulseView : MaterialView {
} }
/** /**
:name: actionForLayer
*/
public override func actionForLayer(layer: CALayer, forKey event: String) -> CAAction? {
return nil // returning nil enables the animations for the layer property that are normally disabled.
}
/**
:name: prepareView :name: prepareView
*/ */
public override func prepareView() { public override func prepareView() {
...@@ -138,7 +145,7 @@ public class MaterialPulseView : MaterialView { ...@@ -138,7 +145,7 @@ public class MaterialPulseView : MaterialView {
userInteractionEnabled = MaterialTheme.pulseView.userInteractionEnabled userInteractionEnabled = MaterialTheme.pulseView.userInteractionEnabled
backgroundColor = MaterialTheme.pulseView.backgroundColor backgroundColor = MaterialTheme.pulseView.backgroundColor
pulseColor = MaterialTheme.pulseView.pulseColor pulseColor = MaterialTheme.pulseView.pulseColor
contentsRect = MaterialTheme.pulseView.contentsRect contentsRect = MaterialTheme.pulseView.contentsRect
contentsCenter = MaterialTheme.pulseView.contentsCenter contentsCenter = MaterialTheme.pulseView.contentsCenter
contentsScale = MaterialTheme.pulseView.contentsScale contentsScale = MaterialTheme.pulseView.contentsScale
...@@ -152,7 +159,9 @@ public class MaterialPulseView : MaterialView { ...@@ -152,7 +159,9 @@ public class MaterialPulseView : MaterialView {
borderColor = MaterialTheme.pulseView.bordercolor borderColor = MaterialTheme.pulseView.bordercolor
// pulseLayer // pulseLayer
materialLayer.visualLayer.addSublayer(pulseLayer) pulseLayer.hidden = true
pulseLayer.zPosition = 1
visualLayer.addSublayer(pulseLayer)
} }
// //
...@@ -179,4 +188,4 @@ public class MaterialPulseView : MaterialView { ...@@ -179,4 +188,4 @@ public class MaterialPulseView : MaterialView {
layer.addAnimation(MaterialAnimation.scale(1, duration: t), forKey: nil) layer.addAnimation(MaterialAnimation.scale(1, duration: t), forKey: nil)
} }
} }
} }
\ No newline at end of file
...@@ -20,41 +20,22 @@ import UIKit ...@@ -20,41 +20,22 @@ import UIKit
@objc(MaterialView) @objc(MaterialView)
public class MaterialView : UIView { public class MaterialView : UIView {
/** //
:name: layerClass // :name: visualLayer
*/ //
public override class func layerClass() -> AnyClass { public private(set) lazy var visualLayer: CAShapeLayer = CAShapeLayer()
return MaterialLayer.self
}
/** /**
:name: materialLayer :name: visualLayer
*/ */
public var materialLayer: MaterialLayer { public weak var delegate: MaterialAnimationDelegate?
return layer as! MaterialLayer
}
/**
:name: delegate
*/
public weak var delegate: MaterialAnimationDelegate? {
get {
return materialLayer.animationDelegate
}
set(value) {
materialLayer.animationDelegate = delegate
}
}
/** /**
:name: image :name: image
*/ */
public var image: UIImage? { public var image: UIImage? {
get { didSet {
return materialLayer.image visualLayer.contents = image?.CGImage
}
set(value) {
materialLayer.image = value
} }
} }
...@@ -62,11 +43,8 @@ public class MaterialView : UIView { ...@@ -62,11 +43,8 @@ public class MaterialView : UIView {
:name: contentsRect :name: contentsRect
*/ */
public var contentsRect: CGRect { public var contentsRect: CGRect {
get { didSet {
return materialLayer.contentsRect visualLayer.contentsRect = contentsRect
}
set(value) {
materialLayer.contentsRect = value
} }
} }
...@@ -74,11 +52,8 @@ public class MaterialView : UIView { ...@@ -74,11 +52,8 @@ public class MaterialView : UIView {
:name: contentsCenter :name: contentsCenter
*/ */
public var contentsCenter: CGRect { public var contentsCenter: CGRect {
get { didSet {
return materialLayer.contentsCenter visualLayer.contentsCenter = contentsCenter
}
set(value) {
materialLayer.contentsCenter = value
} }
} }
...@@ -86,11 +61,8 @@ public class MaterialView : UIView { ...@@ -86,11 +61,8 @@ public class MaterialView : UIView {
:name: contentsScale :name: contentsScale
*/ */
public var contentsScale: CGFloat { public var contentsScale: CGFloat {
get { didSet {
return materialLayer.contentsScale visualLayer.contentsScale = contentsScale
}
set(value) {
materialLayer.contentsScale = value
} }
} }
...@@ -99,7 +71,7 @@ public class MaterialView : UIView { ...@@ -99,7 +71,7 @@ public class MaterialView : UIView {
*/ */
public var contentsGravity: MaterialGravity { public var contentsGravity: MaterialGravity {
didSet { didSet {
materialLayer.contentsGravity = MaterialGravityToString(contentsGravity) visualLayer.contentsGravity = MaterialGravityToString(contentsGravity)
} }
} }
...@@ -108,10 +80,10 @@ public class MaterialView : UIView { ...@@ -108,10 +80,10 @@ public class MaterialView : UIView {
*/ */
public var masksToBounds: Bool { public var masksToBounds: Bool {
get { get {
return materialLayer.masksToBounds return visualLayer.masksToBounds
} }
set(value) { set(value) {
materialLayer.masksToBounds = value visualLayer.masksToBounds = value
} }
} }
...@@ -120,7 +92,7 @@ public class MaterialView : UIView { ...@@ -120,7 +92,7 @@ public class MaterialView : UIView {
*/ */
public override var backgroundColor: UIColor? { public override var backgroundColor: UIColor? {
didSet { didSet {
materialLayer.backgroundColor = backgroundColor?.CGColor layer.backgroundColor = backgroundColor?.CGColor
} }
} }
...@@ -129,10 +101,10 @@ public class MaterialView : UIView { ...@@ -129,10 +101,10 @@ public class MaterialView : UIView {
*/ */
public var x: CGFloat { public var x: CGFloat {
get { get {
return materialLayer.x return frame.origin.x
} }
set(value) { set(value) {
materialLayer.x = value frame.origin.x = value
} }
} }
...@@ -141,10 +113,10 @@ public class MaterialView : UIView { ...@@ -141,10 +113,10 @@ public class MaterialView : UIView {
*/ */
public var y: CGFloat { public var y: CGFloat {
get { get {
return materialLayer.y return frame.origin.y
} }
set(value) { set(value) {
materialLayer.y = value frame.origin.y = value
} }
} }
...@@ -153,10 +125,13 @@ public class MaterialView : UIView { ...@@ -153,10 +125,13 @@ public class MaterialView : UIView {
*/ */
public var width: CGFloat { public var width: CGFloat {
get { get {
return materialLayer.width return frame.size.width
} }
set(value) { set(value) {
materialLayer.width = value frame.size.width = value
if .None != shape {
frame.size.height = value
}
} }
} }
...@@ -165,10 +140,13 @@ public class MaterialView : UIView { ...@@ -165,10 +140,13 @@ public class MaterialView : UIView {
*/ */
public var height: CGFloat { public var height: CGFloat {
get { get {
return materialLayer.height return frame.size.height
} }
set(value) { set(value) {
materialLayer.height = value frame.size.height = value
if .None != shape {
frame.size.width = value
}
} }
} }
...@@ -220,9 +198,14 @@ public class MaterialView : UIView { ...@@ -220,9 +198,14 @@ public class MaterialView : UIView {
/** /**
:name: cornerRadius :name: cornerRadius
*/ */
public var cornerRadius: MaterialRadius { public var cornerRadius: MaterialRadius? {
didSet { didSet {
materialLayer.cornerRadius = MaterialRadiusToValue(cornerRadius) if let v: MaterialRadius = cornerRadius {
layer.cornerRadius = MaterialRadiusToValue(v)
if .Circle == shape {
shape = .None
}
}
} }
} }
...@@ -233,9 +216,9 @@ public class MaterialView : UIView { ...@@ -233,9 +216,9 @@ public class MaterialView : UIView {
didSet { didSet {
if .None != shape { if .None != shape {
if width < height { if width < height {
width = height frame.size.width = height
} else { } else {
height = width frame.size.height = width
} }
} }
} }
...@@ -246,7 +229,7 @@ public class MaterialView : UIView { ...@@ -246,7 +229,7 @@ public class MaterialView : UIView {
*/ */
public var borderWidth: MaterialBorder { public var borderWidth: MaterialBorder {
didSet { didSet {
materialLayer.borderWidth = MaterialBorderToValue(borderWidth) layer.borderWidth = MaterialBorderToValue(borderWidth)
} }
} }
...@@ -255,7 +238,7 @@ public class MaterialView : UIView { ...@@ -255,7 +238,7 @@ public class MaterialView : UIView {
*/ */
public var borderColor: UIColor? { public var borderColor: UIColor? {
didSet { didSet {
materialLayer.borderColor = borderColor?.CGColor layer.borderColor = borderColor?.CGColor
} }
} }
...@@ -299,11 +282,13 @@ public class MaterialView : UIView { ...@@ -299,11 +282,13 @@ public class MaterialView : UIView {
:name: init :name: init
*/ */
public required init?(coder aDecoder: NSCoder) { public required init?(coder aDecoder: NSCoder) {
contentsRect = MaterialTheme.view.contentsRect
contentsCenter = MaterialTheme.view.contentsCenter
contentsScale = MaterialTheme.view.contentsScale
contentsGravity = MaterialTheme.view.contentsGravity contentsGravity = MaterialTheme.view.contentsGravity
cornerRadius = .None
shape = .None
borderWidth = MaterialTheme.view.borderWidth borderWidth = MaterialTheme.view.borderWidth
shadowDepth = .None shadowDepth = .None
shape = .None
super.init(coder: aDecoder) super.init(coder: aDecoder)
} }
...@@ -311,37 +296,77 @@ public class MaterialView : UIView { ...@@ -311,37 +296,77 @@ public class MaterialView : UIView {
:name: init :name: init
*/ */
public override init(frame: CGRect) { public override init(frame: CGRect) {
contentsRect = MaterialTheme.view.contentsRect
contentsCenter = MaterialTheme.view.contentsCenter
contentsScale = MaterialTheme.view.contentsScale
contentsGravity = MaterialTheme.view.contentsGravity contentsGravity = MaterialTheme.view.contentsGravity
cornerRadius = .None
shape = .None
borderWidth = MaterialTheme.view.borderWidth borderWidth = MaterialTheme.view.borderWidth
shadowDepth = .None shadowDepth = .None
shape = .None
super.init(frame: frame) super.init(frame: frame)
prepareView() prepareView()
} }
/** /**
:name: layoutSublayersOfLayer :name: init
*/ */
public override func layoutSublayersOfLayer(layer: CALayer) { public convenience init() {
super.layoutSublayersOfLayer(layer) self.init(frame: CGRectNull)
if self.layer == layer {
prepareShape()
}
} }
/** /**
:name: init :name: layoutSubviews
*/ */
public convenience init() { public override func layoutSubviews() {
self.init(frame: CGRectNull) super.layoutSubviews()
prepareShape()
visualLayer.frame = bounds
visualLayer.position = CGPointMake(width / 2, height / 2)
visualLayer.cornerRadius = layer.cornerRadius
} }
/** /**
:name: animation :name: animation
*/ */
public func animation(animation: CAAnimation) { public func animation(animation: CAAnimation) {
materialLayer.animation(animation) animation.delegate = self
if let a: CABasicAnimation = animation as? CABasicAnimation {
a.fromValue = (nil == layer.presentationLayer() ? layer : layer.presentationLayer() as! CALayer).valueForKeyPath(a.keyPath!)
}
if let a: CAPropertyAnimation = animation as? CAPropertyAnimation {
layer.addAnimation(a, forKey: a.keyPath!)
} else if let a: CAAnimationGroup = animation as? CAAnimationGroup {
layer.addAnimation(a, forKey: nil)
} else if let a: CATransition = animation as? CATransition {
layer.addAnimation(a, forKey: kCATransition)
}
}
/**
:name: animationDidStart
*/
public override func animationDidStart(anim: CAAnimation) {
delegate?.materialAnimationDidStart?(anim)
}
/**
:name: animationDidStop
*/
public override func animationDidStop(anim: CAAnimation, finished flag: Bool) {
if let a: CAPropertyAnimation = anim as? CAPropertyAnimation {
if let b: CABasicAnimation = a as? CABasicAnimation {
MaterialAnimation.animationDisabled({
self.layer.setValue(nil == b.toValue ? b.byValue : b.toValue, forKey: b.keyPath!)
})
}
delegate?.materialAnimationDidStop?(anim, finished: flag)
layer.removeAnimationForKey(a.keyPath!)
} else if let a: CAAnimationGroup = anim as? CAAnimationGroup {
for x in a.animations! {
animationDidStop(x, finished: true)
}
}
} }
// //
...@@ -350,17 +375,17 @@ public class MaterialView : UIView { ...@@ -350,17 +375,17 @@ public class MaterialView : UIView {
public func prepareView() { public func prepareView() {
userInteractionEnabled = MaterialTheme.view.userInteractionEnabled userInteractionEnabled = MaterialTheme.view.userInteractionEnabled
backgroundColor = MaterialTheme.view.backgroundColor backgroundColor = MaterialTheme.view.backgroundColor
contentsRect = MaterialTheme.view.contentsRect
contentsCenter = MaterialTheme.view.contentsCenter
contentsScale = MaterialTheme.view.contentsScale
shape = .None
shadowDepth = MaterialTheme.view.shadowDepth
shadowColor = MaterialTheme.view.shadowColor shadowColor = MaterialTheme.view.shadowColor
zPosition = MaterialTheme.view.zPosition zPosition = MaterialTheme.view.zPosition
masksToBounds = MaterialTheme.view.masksToBounds masksToBounds = MaterialTheme.view.masksToBounds
cornerRadius = MaterialTheme.view.cornerRadius cornerRadius = MaterialTheme.view.cornerRadius
borderColor = MaterialTheme.view.bordercolor borderColor = MaterialTheme.view.bordercolor
// visualLayer
visualLayer.zPosition = -1
layer.addSublayer(visualLayer)
} }
// //
...@@ -368,8 +393,7 @@ public class MaterialView : UIView { ...@@ -368,8 +393,7 @@ public class MaterialView : UIView {
// //
internal func prepareShape() { internal func prepareShape() {
if .Circle == shape { if .Circle == shape {
materialLayer.cornerRadius = width / 2 layer.cornerRadius = width / 2
} }
} }
} }
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