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