Commit d3ed140b by Daniel Dahan

development: updated cornerRadiusPreset enum values and depthPreset enum values

parent a675ae4f
...@@ -50,22 +50,22 @@ public func CornerRadiusPresetToValue(preset: CornerRadiusPreset) -> CGFloat { ...@@ -50,22 +50,22 @@ public func CornerRadiusPresetToValue(preset: CornerRadiusPreset) -> CGFloat {
case .none: case .none:
return 0 return 0
case .cornerRadius1: case .cornerRadius1:
return 4 return 2
case .cornerRadius2: case .cornerRadius2:
return 8 return 4
case .cornerRadius3: case .cornerRadius3:
return 16 return 8
case .cornerRadius4: case .cornerRadius4:
return 24 return 12
case .cornerRadius5: case .cornerRadius5:
return 32 return 16
case .cornerRadius6: case .cornerRadius6:
return 40 return 20
case .cornerRadius7: case .cornerRadius7:
return 48 return 24
case .cornerRadius8: case .cornerRadius8:
return 56 return 28
case .cornerRadius9: case .cornerRadius9:
return 64 return 32
} }
} }
...@@ -96,14 +96,14 @@ public func DepthPresetToValue(preset: DepthPreset) -> Depth { ...@@ -96,14 +96,14 @@ public func DepthPresetToValue(preset: DepthPreset) -> Depth {
case .none: case .none:
return .zero return .zero
case .depth1: case .depth1:
return Depth(offset: Offset(horizontal: 0, vertical: 1), opacity: 0.3, radius: 1) return Depth(offset: Offset(horizontal: 0, vertical: 0.5), opacity: 0.3, radius: 0.5)
case .depth2: case .depth2:
return Depth(offset: Offset(horizontal: 0, vertical: 2), opacity: 0.3, radius: 2) return Depth(offset: Offset(horizontal: 0, vertical: 1), opacity: 0.3, radius: 1)
case .depth3: case .depth3:
return Depth(offset: Offset(horizontal: 0, vertical: 3), opacity: 0.3, radius: 3) return Depth(offset: Offset(horizontal: 0, vertical: 2), opacity: 0.3, radius: 2)
case .depth4: case .depth4:
return Depth(offset: Offset(horizontal: 0, vertical: 4), opacity: 0.3, radius: 4) return Depth(offset: Offset(horizontal: 0, vertical: 4), opacity: 0.3, radius: 4)
case .depth5: case .depth5:
return Depth(offset: Offset(horizontal: 0, vertical: 5), opacity: 0.3, radius: 5) return Depth(offset: Offset(horizontal: 0, vertical: 8), opacity: 0.3, radius: 8)
} }
} }
...@@ -35,7 +35,7 @@ internal class MaterialLayer { ...@@ -35,7 +35,7 @@ internal class MaterialLayer {
internal weak var layer: CALayer? internal weak var layer: CALayer?
/// A property that sets the cornerRadius of the backing layer. /// A property that sets the cornerRadius of the backing layer.
internal var cornerRadiusPreset: CornerRadiusPreset = .none { internal var cornerRadiusPreset = CornerRadiusPreset.none {
didSet { didSet {
guard let v = layer else { guard let v = layer else {
return return
...@@ -45,7 +45,7 @@ internal class MaterialLayer { ...@@ -45,7 +45,7 @@ internal class MaterialLayer {
} }
/// A preset property to set the borderWidth. /// A preset property to set the borderWidth.
internal var borderWidthPreset: BorderWidthPreset = .none { internal var borderWidthPreset = BorderWidthPreset.none {
didSet { didSet {
guard let v = layer else { guard let v = layer else {
return return
...@@ -55,7 +55,7 @@ internal class MaterialLayer { ...@@ -55,7 +55,7 @@ internal class MaterialLayer {
} }
/// A preset property to set the shape. /// A preset property to set the shape.
internal var shapePreset: ShapePreset = .none internal var shapePreset = ShapePreset.none
/// A preset value for Depth. /// A preset value for Depth.
internal var depthPreset: DepthPreset { internal var depthPreset: DepthPreset {
...@@ -317,7 +317,10 @@ extension CALayer { ...@@ -317,7 +317,10 @@ extension CALayer {
/// Sets the shadow path. /// Sets the shadow path.
open func layoutShadowPath() { open func layoutShadowPath() {
if isShadowPathAutoSizing { guard isShadowPathAutoSizing else {
return
}
if .none == depthPreset { if .none == depthPreset {
shadowPath = nil shadowPath = nil
} else if nil == shadowPath { } else if nil == shadowPath {
...@@ -326,5 +329,4 @@ extension CALayer { ...@@ -326,5 +329,4 @@ extension CALayer {
animate(animation: Animation.shadowPath(path: UIBezierPath(roundedRect: bounds, cornerRadius: cornerRadius).cgPath, duration: 0)) animate(animation: Animation.shadowPath(path: UIBezierPath(roundedRect: bounds, cornerRadius: cornerRadius).cgPath, duration: 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