From 51c2d5e992255b9801cfdb0704fde95fa9afd64d Mon Sep 17 00:00:00 2001 From: Peter <> Date: Fri, 26 Apr 2019 15:28:49 +0400 Subject: [PATCH] ImmediateTextNode: added trailingLineWidth --- Display/ImmediateTextNode.swift | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Display/ImmediateTextNode.swift b/Display/ImmediateTextNode.swift index 65094245e4..7eb149227b 100644 --- a/Display/ImmediateTextNode.swift +++ b/Display/ImmediateTextNode.swift @@ -18,6 +18,8 @@ public class ImmediateTextNode: TextNode { public var linkHighlightColor: UIColor? + public var trailingLineWidth: CGFloat? + public var highlightAttributeAction: (([NSAttributedStringKey: Any]) -> NSAttributedStringKey?)? { didSet { if self.isNodeLoaded { @@ -33,6 +35,11 @@ public class ImmediateTextNode: TextNode { let makeLayout = TextNode.asyncLayout(self) let (layout, apply) = makeLayout(TextNodeLayoutArguments(attributedString: self.attributedText, backgroundColor: nil, maximumNumberOfLines: self.maximumNumberOfLines, truncationType: self.truncationType, constrainedSize: constrainedSize, alignment: self.textAlignment, lineSpacing: self.lineSpacing, cutout: nil, insets: self.insets)) let _ = apply() + if layout.numberOfLines > 1 { + self.trailingLineWidth = layout.trailingLineWidth + } else { + self.trailingLineWidth = nil + } return layout.size }