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.leadingAnchor.constraint(equalTo: selectorView.leadingAnchor, constant: 16).isActive = true
|
||||||
mainStackView.trailingAnchor.constraint(equalTo: selectorView.trailingAnchor, constant: -16).isActive = true
|
mainStackView.trailingAnchor.constraint(equalTo: selectorView.trailingAnchor, constant: -16).isActive = true
|
||||||
mainStackView.bottomAnchor.constraint(equalTo: selectorView.bottomAnchor, constant: -16).isActive = true
|
mainStackView.bottomAnchor.constraint(equalTo: selectorView.bottomAnchor, constant: -16).isActive = true
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func updateLabels(_ viewModel: ModelType) {
|
func updateLabels(_ viewModel: ModelType) {
|
||||||
@ -329,17 +329,30 @@ open class RadioBoxBase<ModelType: RadioBoxModel>: Control<ModelType>, Changable
|
|||||||
let borderColor = radioBoxBorderColorConfiguration.getColor(viewModel)
|
let borderColor = radioBoxBorderColorConfiguration.getColor(viewModel)
|
||||||
let borderWidth = viewModel.selected ? selectorBorderWidthSelected : selectorBorderWidth
|
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) {
|
if let shapeLayer = shapeLayer, let sublayers = layer.sublayers, sublayers.contains(shapeLayer) {
|
||||||
shapeLayer.removeFromSuperlayer()
|
shapeLayer.removeFromSuperlayer()
|
||||||
self.shapeLayer = nil
|
self.shapeLayer = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
selectorView.backgroundColor = backgroundColor
|
if shapeLayer == nil && model.strikethrough {
|
||||||
selectorView.layer.borderColor = borderColor.cgColor
|
|
||||||
selectorView.layer.cornerRadius = selectorCornerRadius
|
|
||||||
selectorView.layer.borderWidth = borderWidth
|
|
||||||
|
|
||||||
if shapeLayer == nil && viewModel.strikethrough {
|
|
||||||
let bounds = selectorView.bounds
|
let bounds = selectorView.bounds
|
||||||
let length = max(bounds.size.height, bounds.size.width)
|
let length = max(bounds.size.height, bounds.size.width)
|
||||||
guard length > 0.0, shapeLayer == nil else { return }
|
guard length > 0.0, shapeLayer == nil else { return }
|
||||||
@ -360,7 +373,6 @@ open class RadioBoxBase<ModelType: RadioBoxModel>: Control<ModelType>, Changable
|
|||||||
shapeLayer = border
|
shapeLayer = border
|
||||||
layer.addSublayer(border)
|
layer.addSublayer(border)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user