added edgeInset

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2023-06-15 18:50:30 -05:00
parent 00edeac169
commit bbdf496cda

View File

@ -39,6 +39,14 @@ open class Label: UILabel, Handlerable, ViewProtocol, Resettable, UserInfoable {
open var userInfo = [String: Primitive]()
open var edgeInset: UIEdgeInsets = .zero {
didSet {
setNeedsUpdate()
}
}
override open var text: String? {
didSet {
attributes = nil
@ -193,6 +201,15 @@ open class Label: UILabel, Handlerable, ViewProtocol, Resettable, UserInfoable {
}
}
open override func drawText(in rect: CGRect) {
super.drawText(in: rect.inset(by: edgeInset))
}
open override var intrinsicContentSize: CGSize {
let size = super.intrinsicContentSize
return CGSize(width: size.width + edgeInset.left + edgeInset.right, height: size.height + edgeInset.top + edgeInset.bottom)
}
//--------------------------------------------------
// MARK: - Actionable
//--------------------------------------------------