Merge branch 'mbruce/bugfixes' into 'develop'
refactored See merge request BPHV_MIPS/vds_ios!113
This commit is contained in:
commit
7f9d64ff99
@ -78,12 +78,7 @@ open class Control: UIControl, ViewProtocol, UserInfoable, Clickable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Whether the Control is enabled or not.
|
/// Whether the Control is enabled or not.
|
||||||
open override var isEnabled: Bool {
|
open override var isEnabled: Bool { didSet { setNeedsUpdate() } }
|
||||||
didSet {
|
|
||||||
setNeedsUpdate()
|
|
||||||
//isUserInteractionEnabled = isEnabled
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Lifecycle
|
// MARK: - Lifecycle
|
||||||
|
|||||||
@ -69,9 +69,7 @@ open class Icon: View {
|
|||||||
open var customSize: Int? { didSet { setNeedsUpdate() } }
|
open var customSize: Int? { didSet { setNeedsUpdate() } }
|
||||||
|
|
||||||
/// 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 { dimensions }
|
||||||
dimensions
|
|
||||||
}
|
|
||||||
|
|
||||||
//functions
|
//functions
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|||||||
@ -41,6 +41,12 @@ open class Line: View {
|
|||||||
case horizontal, vertical
|
case horizontal, vertical
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Configuration
|
||||||
|
//--------------------------------------------------
|
||||||
|
/// Width of the line.
|
||||||
|
public let lineWidth: CGFloat = 1.0
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Public Properties
|
// MARK: - Public Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -83,9 +89,7 @@ open class Line: View {
|
|||||||
open override func updateView() {
|
open override func updateView() {
|
||||||
super.updateView()
|
super.updateView()
|
||||||
|
|
||||||
backgroundColor = lineViewColorConfiguration.getColor(self)
|
setNeedsDisplay()
|
||||||
|
|
||||||
invalidateIntrinsicContentSize()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Resets to default settings.
|
/// Resets to default settings.
|
||||||
@ -94,4 +98,22 @@ open class Line: View {
|
|||||||
style = .primary
|
style = .primary
|
||||||
orientation = .horizontal
|
orientation = .horizontal
|
||||||
}
|
}
|
||||||
|
|
||||||
|
open override func draw(_ rect: CGRect) {
|
||||||
|
guard let context = UIGraphicsGetCurrentContext() else { return }
|
||||||
|
|
||||||
|
context.setStrokeColor(lineViewColorConfiguration.getColor(self).cgColor)
|
||||||
|
context.setLineWidth(lineWidth)
|
||||||
|
|
||||||
|
if orientation == .horizontal {
|
||||||
|
context.move(to: CGPoint(x: 0, y: rect.height / 2))
|
||||||
|
context.addLine(to: CGPoint(x: rect.width, y: rect.height / 2))
|
||||||
|
} else {
|
||||||
|
context.move(to: CGPoint(x: rect.width / 2, y: 0))
|
||||||
|
context.addLine(to: CGPoint(x: rect.width / 2, y: rect.height))
|
||||||
|
}
|
||||||
|
|
||||||
|
context.strokePath()
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user