From bacdfcc6afa38b395ed5afa3c0f1d45ff0ae81d8 Mon Sep 17 00:00:00 2001 From: Peter <> Date: Wed, 3 Oct 2018 02:39:41 +0400 Subject: [PATCH] TextNode width extension fix --- Display/TextNode.swift | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Display/TextNode.swift b/Display/TextNode.swift index ed6a16b36f..e55480d261 100644 --- a/Display/TextNode.swift +++ b/Display/TextNode.swift @@ -475,7 +475,14 @@ public class TextNode: ASDisplayNode { } if !lines.isEmpty && bottomCutoutEnabled { - layoutSize.width = max(layoutSize.width, lines[lines.count - 1].frame.width + bottomCutoutSize.width) + let proposedWidth = lines[lines.count - 1].frame.width + bottomCutoutSize.width + if proposedWidth > layoutSize.width { + if proposedWidth < constrainedSize.width { + layoutSize.width = proposedWidth + } else { + layoutSize.height += bottomCutoutSize.height + } + } } return TextNodeLayout(attributedString: attributedString, maximumNumberOfLines: maximumNumberOfLines, truncationType: truncationType, constrainedSize: constrainedSize, alignment: alignment, lineSpacing: lineSpacingFactor, cutout: cutout, insets: insets, size: CGSize(width: ceil(layoutSize.width) + insets.left + insets.right, height: ceil(layoutSize.height) + insets.top + insets.bottom), firstLineOffset: firstLineOffset, lines: lines, backgroundColor: backgroundColor)