Merge branch 'hotfix/vds-label-actions' into 'release/20_0_0'

refactored out code that is now in VDS.Label

### Summary
Code refactored down in to VDS Label, therefor this needed to be removed. 

### JIRA Ticket
https://onejira.verizon.com/browse/CXTDT-576006

Co-authored-by: Matt Bruce <matt.bruce@verizon.com>

See merge request https://gitlab.verizon.com/BPHV_MIPS/mvm_core_ui/-/merge_requests/1136
This commit is contained in:
Hedden, Kyle Matthew 2024-06-21 19:18:31 +00:00
commit 3cdd74f097

View File

@ -364,8 +364,8 @@ extension Label {
public static func boundingRect(forCharacterRange range: NSRange, in label: Label) -> CGRect {
guard let abstractContainer = label.abstractTextContainer() else { return CGRect() }
let textContainer = abstractContainer.0
let layoutManager = abstractContainer.1
let textContainer = abstractContainer.textContainer
let layoutManager = abstractContainer.layoutManager
var glyphRange = NSRange()
@ -374,36 +374,6 @@ extension Label {
return layoutManager.boundingRect(forGlyphRange: glyphRange, in: textContainer)
}
/**
Provides a text container and layout manager of how the text would appear on screen.
They are used in tandem to derive low-level TextKit results of the label.
*/
public func abstractTextContainer() -> (NSTextContainer, NSLayoutManager, NSTextStorage)? {
// Must configure the attributed string to translate what would appear on screen to accurately analyze.
guard let attributedText = attributedText else { return nil }
let paragraph = NSMutableParagraphStyle()
paragraph.alignment = textAlignment
let stagedAttributedString = NSMutableAttributedString(attributedString: attributedText)
stagedAttributedString.addAttributes([NSAttributedString.Key.paragraphStyle: paragraph], range: NSRange(location: 0, length: attributedText.string.count))
let textStorage = NSTextStorage(attributedString: stagedAttributedString)
let layoutManager = NSLayoutManager()
let textContainer = NSTextContainer(size: .zero)
layoutManager.addTextContainer(textContainer)
textStorage.addLayoutManager(layoutManager)
textContainer.lineFragmentPadding = 0.0
textContainer.lineBreakMode = lineBreakMode
textContainer.maximumNumberOfLines = numberOfLines
textContainer.size = bounds.size
return (textContainer, layoutManager, textStorage)
}
}
// MARK: - Atomization