updated property getter for lineColor
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
0fc6d78d3c
commit
a3d239779d
@ -45,7 +45,7 @@ open class Line: View {
|
|||||||
// MARK: - Configuration
|
// MARK: - Configuration
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
/// Width of the line.
|
/// Width of the line.
|
||||||
public static let lineWidth: CGFloat = 1.0
|
public let lineWidth: CGFloat = 1.0
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Public Properties
|
// MARK: - Public Properties
|
||||||
@ -56,12 +56,15 @@ open class Line: View {
|
|||||||
/// Allows to render the line vertically.
|
/// Allows to render the line vertically.
|
||||||
open var orientation: Orientation = .horizontal { didSet { setNeedsUpdate() } }
|
open var orientation: Orientation = .horizontal { didSet { setNeedsUpdate() } }
|
||||||
|
|
||||||
|
/// Line Color for current Style and Surface.
|
||||||
|
open var lineColor: UIColor { lineViewColorConfiguration.getColor(self) }
|
||||||
|
|
||||||
/// The natural size for the receiving view, considering only properties of the view itself.
|
/// The natural size for the receiving view, considering only properties of the view itself.
|
||||||
open override var intrinsicContentSize: CGSize {
|
open override var intrinsicContentSize: CGSize {
|
||||||
if orientation == .vertical {
|
if orientation == .vertical {
|
||||||
return .init(width: Self.lineWidth, height: bounds.height)
|
return .init(width: lineWidth, height: bounds.height)
|
||||||
} else {
|
} else {
|
||||||
return .init(width: bounds.width, height: Self.lineWidth)
|
return .init(width: bounds.width, height: lineWidth)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,8 +105,8 @@ open class Line: View {
|
|||||||
open override func draw(_ rect: CGRect) {
|
open override func draw(_ rect: CGRect) {
|
||||||
guard let context = UIGraphicsGetCurrentContext() else { return }
|
guard let context = UIGraphicsGetCurrentContext() else { return }
|
||||||
|
|
||||||
context.setStrokeColor(lineViewColorConfiguration.getColor(self).cgColor)
|
context.setStrokeColor(lineColor.cgColor)
|
||||||
context.setLineWidth(Self.lineWidth)
|
context.setLineWidth(lineWidth)
|
||||||
|
|
||||||
if orientation == .horizontal {
|
if orientation == .horizontal {
|
||||||
context.move(to: CGPoint(x: 0, y: rect.height / 2))
|
context.move(to: CGPoint(x: 0, y: rect.height / 2))
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user