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