fixed bug for borderline in horizontal - top configuration

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2023-06-08 08:56:04 -05:00
parent becc365bd1
commit 439c66fb97

View File

@ -104,7 +104,7 @@ open class Tabs: View {
private var tabStackView: UIStackView! private var tabStackView: UIStackView!
private var scrollView: UIScrollView! private var scrollView: UIScrollView!
private var contentView: View! private var contentView: View!
private var borderlineColorConfig = SurfaceColorConfiguration(VDSColor.elementsLowcontrastOnlight, VDSColor.elementsLowcontrastOndark) private var borderlineColorConfiguration = SurfaceColorConfiguration(VDSColor.elementsLowcontrastOnlight, VDSColor.elementsLowcontrastOndark)
private var contentViewWidthConstraint: NSLayoutConstraint? private var contentViewWidthConstraint: NSLayoutConstraint?
//-------------------------------------------------- //--------------------------------------------------
@ -255,20 +255,16 @@ open class Tabs: View {
scrollView.contentSize = bounds.size scrollView.contentSize = bounds.size
} }
// Apply border line //borderLine
layer.remove(layerName: "borderLineLayer") removeBorders()
if borderLine { if borderLine {
let borderLineLayer = CALayer() var edge: UIRectEdge = .bottom
borderLineLayer.name = "borderLineLayer" if orientation == .vertical {
borderLineLayer.backgroundColor = borderlineColorConfig.getColor(self).cgColor edge = .left
} else if indicatorPosition == .top {
if orientation == .horizontal { edge = .top
borderLineLayer.frame = CGRect(x: 0, y: bounds.height - 1, width: bounds.width, height: 1)
} else {
borderLineLayer.frame = CGRect(x: 0, y: 0, width: 1, height: bounds.height)
} }
addBorder(side: edge, width: 1, color: borderlineColorConfiguration.getColor(self))
layer.addSublayer(borderLineLayer)
} }
scrollToSelectedIndex(animated: true) scrollToSelectedIndex(animated: true)