Radio swatch elements - modify story commit
This commit is contained in:
parent
d0ea5d828b
commit
f46b9cb339
@ -25,6 +25,7 @@ open class RadioSwatchItem: UICollectionViewCell, MoleculeViewProtocol {
|
|||||||
|
|
||||||
var isStrikeThrough: Bool = false {
|
var isStrikeThrough: Bool = false {
|
||||||
didSet {
|
didSet {
|
||||||
|
cellView.layer.sublayers?.filter({$0.name == "OutOfStock"}).forEach({$0.removeFromSuperlayer()})
|
||||||
if isStrikeThrough {
|
if isStrikeThrough {
|
||||||
drawStrikeThrough()
|
drawStrikeThrough()
|
||||||
}
|
}
|
||||||
@ -44,7 +45,8 @@ open class RadioSwatchItem: UICollectionViewCell, MoleculeViewProtocol {
|
|||||||
public func drawCircle() {
|
public func drawCircle() {
|
||||||
circleLayer.path = UIBezierPath(ovalIn: CGRect(x: 12, y: 1, width: 30, height: 30)).cgPath
|
circleLayer.path = UIBezierPath(ovalIn: CGRect(x: 12, y: 1, width: 30, height: 30)).cgPath
|
||||||
circleLayer.fillColor = fillColor.cgColor
|
circleLayer.fillColor = fillColor.cgColor
|
||||||
circleLayer.strokeColor = UIColor.mvmCoolGray6.cgColor
|
circleLayer.strokeColor = UIColor.mvmBlack.cgColor
|
||||||
|
circleLayer.lineWidth = 1
|
||||||
cellView.layer.addSublayer(circleLayer)
|
cellView.layer.addSublayer(circleLayer)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,18 +58,19 @@ open class RadioSwatchItem: UICollectionViewCell, MoleculeViewProtocol {
|
|||||||
bezierPath.addLine(to: endPoint)
|
bezierPath.addLine(to: endPoint)
|
||||||
let strikeThroughLayer = CAShapeLayer()
|
let strikeThroughLayer = CAShapeLayer()
|
||||||
strikeThroughLayer.path = bezierPath.cgPath
|
strikeThroughLayer.path = bezierPath.cgPath
|
||||||
strikeThroughLayer.strokeColor = UIColor.mvmBlack.cgColor
|
strikeThroughLayer.name = "OutOfStock"
|
||||||
|
strikeThroughLayer.strokeColor = UIColor.mvmCoolGray6.cgColor
|
||||||
strikeThroughLayer.lineWidth = 1
|
strikeThroughLayer.lineWidth = 1
|
||||||
cellView.layer.addSublayer(strikeThroughLayer)
|
cellView.layer.addSublayer(strikeThroughLayer)
|
||||||
isUserInteractionEnabled = false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public func drawOuterCircle() {
|
public func drawOuterCircle() {
|
||||||
circleLayer.path = UIBezierPath(ovalIn: CGRect(x: 15, y: 4, width: 24, height: 24)).cgPath
|
circleLayer.path = UIBezierPath(ovalIn: CGRect(x: 15, y: 4, width: 24, height: 24)).cgPath
|
||||||
outerCircleLayer.path = UIBezierPath(ovalIn: CGRect(x: 12, y: 1, width: 30, height: 30)).cgPath
|
outerCircleLayer.path = UIBezierPath(ovalIn: CGRect(x: 12, y: 1, width: 30, height: 30)).cgPath
|
||||||
outerCircleLayer.name = "OuterCircle"
|
outerCircleLayer.name = "OuterCircle"
|
||||||
outerCircleLayer.strokeColor = UIColor.mvmCoolGray6.cgColor
|
outerCircleLayer.strokeColor = UIColor.mvmBlack.cgColor
|
||||||
outerCircleLayer.fillColor = UIColor.clear.cgColor
|
outerCircleLayer.fillColor = UIColor.clear.cgColor
|
||||||
|
outerCircleLayer.lineWidth = 1
|
||||||
cellView.layer.addSublayer(outerCircleLayer)
|
cellView.layer.addSublayer(outerCircleLayer)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user