updated when strikethrough is drawn
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
3eeb6f5dcb
commit
06f25259f7
@ -163,7 +163,7 @@ open class RadioBoxBase<ModelType: RadioBoxModel>: Control<ModelType>, Changable
|
||||
mainStackView.leadingAnchor.constraint(equalTo: selectorView.leadingAnchor, constant: 16).isActive = true
|
||||
mainStackView.trailingAnchor.constraint(equalTo: selectorView.trailingAnchor, constant: -16).isActive = true
|
||||
mainStackView.bottomAnchor.constraint(equalTo: selectorView.bottomAnchor, constant: -16).isActive = true
|
||||
|
||||
|
||||
}
|
||||
|
||||
func updateLabels(_ viewModel: ModelType) {
|
||||
@ -329,17 +329,30 @@ open class RadioBoxBase<ModelType: RadioBoxModel>: Control<ModelType>, Changable
|
||||
let borderColor = radioBoxBorderColorConfiguration.getColor(viewModel)
|
||||
let borderWidth = viewModel.selected ? selectorBorderWidthSelected : selectorBorderWidth
|
||||
|
||||
selectorView.backgroundColor = backgroundColor
|
||||
selectorView.layer.borderColor = borderColor.cgColor
|
||||
selectorView.layer.cornerRadius = selectorCornerRadius
|
||||
selectorView.layer.borderWidth = borderWidth
|
||||
|
||||
setNeedsDisplay()
|
||||
}
|
||||
|
||||
open override func layoutSubviews() {
|
||||
super.layoutSubviews()
|
||||
// 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
|
||||
}
|
||||
|
||||
selectorView.backgroundColor = backgroundColor
|
||||
selectorView.layer.borderColor = borderColor.cgColor
|
||||
selectorView.layer.cornerRadius = selectorCornerRadius
|
||||
selectorView.layer.borderWidth = borderWidth
|
||||
|
||||
if shapeLayer == nil && viewModel.strikethrough {
|
||||
if shapeLayer == nil && model.strikethrough {
|
||||
let bounds = selectorView.bounds
|
||||
let length = max(bounds.size.height, bounds.size.width)
|
||||
guard length > 0.0, shapeLayer == nil else { return }
|
||||
@ -360,7 +373,6 @@ open class RadioBoxBase<ModelType: RadioBoxModel>: Control<ModelType>, Changable
|
||||
shapeLayer = border
|
||||
layer.addSublayer(border)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------
|
||||
|
||||
Loading…
Reference in New Issue
Block a user