mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-08-26 23:39:12 +00:00
16 lines
772 B
Swift
16 lines
772 B
Swift
import Foundation
|
|
|
|
public class ImmediateTextNode: TextNode {
|
|
public var attributedText: NSAttributedString?
|
|
public var textAlignment: NSTextAlignment = .natural
|
|
public var maximumNumberOfLines: Int = 1
|
|
public var lineSpacing: CGFloat = 0.0
|
|
|
|
public func updateLayout(_ constrainedSize: CGSize) -> CGSize {
|
|
let makeLayout = TextNode.asyncLayout(self)
|
|
let (layout, apply) = makeLayout(TextNodeLayoutArguments(attributedString: self.attributedText, backgroundColor: nil, maximumNumberOfLines: self.maximumNumberOfLines, truncationType: .end, constrainedSize: constrainedSize, alignment: self.textAlignment, lineSpacing: self.lineSpacing, cutout: nil, insets: UIEdgeInsets()))
|
|
let _ = apply()
|
|
return layout.size
|
|
}
|
|
}
|