added edgeInsets

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2023-07-20 12:54:03 -05:00
parent 838a68348a
commit 0460e10b89

View File

@ -33,6 +33,8 @@ open class Label: UILabel, Handlerable, ViewProtocol, Resettable, UserInfoable {
open var textStyle: TextStyle = .defaultStyle { didSet { setNeedsUpdate() }}
open var edgeInsets: UIEdgeInsets { textStyle.edgeInsets }
open var textPosition: TextPosition = .left { didSet { setNeedsUpdate() }}
open var userInfo = [String: Primitive]()
@ -115,6 +117,13 @@ open class Label: UILabel, Handlerable, ViewProtocol, Resettable, UserInfoable {
setNeedsUpdate()
}
//--------------------------------------------------
// MARK: - Overrides
//--------------------------------------------------
open override func drawText(in rect: CGRect) {
super.drawText(in: rect.inset(by: edgeInsets))
}
//--------------------------------------------------
// MARK: - Overrides
//--------------------------------------------------
@ -134,7 +143,12 @@ open class Label: UILabel, Handlerable, ViewProtocol, Resettable, UserInfoable {
//set the attributed text
attributedText = mutableText
//get accessibility
updateAccessibilityLabel()
//force a drawText
setNeedsDisplay()
}
}
}