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