mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-24 07:05:35 +00:00
[ASTextNode] Ensure that isTruncated computes the correct value when sizing fast-path is used. (#2550) (#2763)
* Fix fast-path isTruncated. * Clean up formatting; remove extra char.
This commit is contained in:
@@ -261,6 +261,18 @@ static NSCharacterSet *_defaultAvoidTruncationCharacterSet()
|
||||
return lineCount;
|
||||
}
|
||||
|
||||
- (BOOL)isTruncated
|
||||
{
|
||||
if (self.canUseFastPath) {
|
||||
CGRect boundedRect = [_attributes.attributedString boundingRectWithSize:CGSizeMake(_constrainedSize.width, CGFLOAT_MAX)
|
||||
options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingTruncatesLastVisibleLine
|
||||
context:nil];
|
||||
return boundedRect.size.height > _constrainedSize.height;
|
||||
} else {
|
||||
return self.firstVisibleRange.length < _attributes.attributedString.length;
|
||||
}
|
||||
}
|
||||
|
||||
- (std::vector<NSRange>)visibleRanges
|
||||
{
|
||||
return _truncater.visibleRanges;
|
||||
|
||||
Reference in New Issue
Block a user