diff --git a/VDS/Components/RadioBox/RadioBox.swift b/VDS/Components/RadioBox/RadioBox.swift index a649fc41..1f7cf959 100644 --- a/VDS/Components/RadioBox/RadioBox.swift +++ b/VDS/Components/RadioBox/RadioBox.swift @@ -342,17 +342,15 @@ open class RadioBoxBase: Control, Changable // Accounts for any size changes layer.setNeedsDisplay() } - + open override func draw(_ layer: CALayer, in ctx: CGContext) { let borderColor = radioBoxBorderColorConfiguration.getColor(model) - - if let shapeLayer = shapeLayer, let sublayers = layer.sublayers, sublayers.contains(shapeLayer) { - shapeLayer.removeFromSuperlayer() - self.shapeLayer = nil - } - - if shapeLayer == nil && model.strikethrough { + + shapeLayer?.removeFromSuperlayer() + shapeLayer = nil + + if model.strikethrough { let bounds = selectorView.bounds let length = max(bounds.size.height, bounds.size.width) guard length > 0.0, shapeLayer == nil else { return } @@ -363,9 +361,9 @@ open class RadioBoxBase: Control, Changable border.opacity = 1.0 border.lineWidth = strikeThroughLineThickness border.strokeColor = borderColor.cgColor - + let linePath = UIBezierPath() - + let offsetPercent: CGFloat = 0.005 linePath.move(to: CGPoint(x: selectorCornerRadius, y: bounds.height * (1 - offsetPercent))) linePath.addLine(to: CGPoint(x: bounds.width - selectorCornerRadius, y: bounds.height * offsetPercent))