added check for change of scaledFonts
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
a09d77760d
commit
61e843f8f8
@ -53,6 +53,8 @@ open class ButtonBase: UIButton, Buttonable, Handlerable, ViewProtocol, Resettab
|
|||||||
|
|
||||||
open var attributes: [any LabelAttributeModel]? { nil }
|
open var attributes: [any LabelAttributeModel]? { nil }
|
||||||
|
|
||||||
|
open var useScaledFont: Bool = false { didSet { setNeedsUpdate() }}
|
||||||
|
|
||||||
open var surface: Surface = .light { didSet { setNeedsUpdate() }}
|
open var surface: Surface = .light { didSet { setNeedsUpdate() }}
|
||||||
|
|
||||||
open var userInfo = [String: Primitive]()
|
open var userInfo = [String: Primitive]()
|
||||||
@ -177,6 +179,7 @@ open class ButtonBase: UIButton, Buttonable, Handlerable, ViewProtocol, Resettab
|
|||||||
//create the primary string
|
//create the primary string
|
||||||
let mutableText = NSMutableAttributedString.mutableText(for: text ?? "No Text",
|
let mutableText = NSMutableAttributedString.mutableText(for: text ?? "No Text",
|
||||||
textStyle: textStyle,
|
textStyle: textStyle,
|
||||||
|
useScaledFont: useScaledFont,
|
||||||
textColor: textColor,
|
textColor: textColor,
|
||||||
alignment: titleLabel?.textAlignment ?? .center,
|
alignment: titleLabel?.textAlignment ?? .center,
|
||||||
lineBreakMode: titleLabel?.lineBreakMode ?? .byTruncatingTail)
|
lineBreakMode: titleLabel?.lineBreakMode ?? .byTruncatingTail)
|
||||||
|
|||||||
@ -27,6 +27,8 @@ open class Label: UILabel, Handlerable, ViewProtocol, Resettable, UserInfoable {
|
|||||||
|
|
||||||
open var useAttributedText: Bool = false
|
open var useAttributedText: Bool = false
|
||||||
|
|
||||||
|
open var useScaledFont: Bool = false { didSet { setNeedsUpdate() }}
|
||||||
|
|
||||||
open var surface: Surface = .light { didSet { setNeedsUpdate() }}
|
open var surface: Surface = .light { didSet { setNeedsUpdate() }}
|
||||||
|
|
||||||
open var attributes: [any LabelAttributeModel]? { didSet { setNeedsUpdate() }}
|
open var attributes: [any LabelAttributeModel]? { didSet { setNeedsUpdate() }}
|
||||||
@ -89,6 +91,13 @@ open class Label: UILabel, Handlerable, ViewProtocol, Resettable, UserInfoable {
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
open func initialSetup() {
|
open func initialSetup() {
|
||||||
if !initialSetupPerformed {
|
if !initialSetupPerformed {
|
||||||
|
//register for ContentSizeChanges
|
||||||
|
NotificationCenter
|
||||||
|
.Publisher(center: .default, name: UIContentSizeCategory.didChangeNotification)
|
||||||
|
.sink { [weak self] notification in
|
||||||
|
self?.setNeedsUpdate()
|
||||||
|
}.store(in: &subscribers)
|
||||||
|
|
||||||
backgroundColor = .clear
|
backgroundColor = .clear
|
||||||
numberOfLines = 0
|
numberOfLines = 0
|
||||||
lineBreakMode = .byWordWrapping
|
lineBreakMode = .byWordWrapping
|
||||||
@ -135,6 +144,7 @@ open class Label: UILabel, Handlerable, ViewProtocol, Resettable, UserInfoable {
|
|||||||
//create the primary string
|
//create the primary string
|
||||||
let mutableText = NSMutableAttributedString.mutableText(for: text,
|
let mutableText = NSMutableAttributedString.mutableText(for: text,
|
||||||
textStyle: textStyle,
|
textStyle: textStyle,
|
||||||
|
useScaledFont: useScaledFont,
|
||||||
textColor: textColorConfiguration.getColor(self),
|
textColor: textColorConfiguration.getColor(self),
|
||||||
alignment: textPosition.textAlignment,
|
alignment: textPosition.textAlignment,
|
||||||
lineBreakMode: lineBreakMode)
|
lineBreakMode: lineBreakMode)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user