Fix input text sizing

This commit is contained in:
Peter 2019-10-10 00:20:15 +04:00
parent 79091c3dd8
commit 44b9d681b5
2 changed files with 2 additions and 2 deletions

View File

@ -446,7 +446,7 @@
textSize = [displayedComponents sizeForConstrainedWidth:constrainedSize.width]; textSize = [displayedComponents sizeForConstrainedWidth:constrainedSize.width];
} }
CGFloat width = std::ceil(textSize.width + _textContainerInset.left + _textContainerInset.right); CGFloat width = std::ceil(constrainedSize.width);
CGFloat height = std::ceil(textSize.height + _textContainerInset.top + _textContainerInset.bottom); CGFloat height = std::ceil(textSize.height + _textContainerInset.top + _textContainerInset.bottom);
return CGSizeMake(std::fmin(width, constrainedSize.width), std::fmin(height, constrainedSize.height)); return CGSizeMake(std::fmin(width, constrainedSize.width), std::fmin(height, constrainedSize.height));
} }

View File

@ -129,7 +129,7 @@
// If our text-view's width is already the constrained width, we can use our existing TextKit stack for this sizing calculation. // If our text-view's width is already the constrained width, we can use our existing TextKit stack for this sizing calculation.
// Otherwise, we create a temporary stack to size for `constrainedWidth`. // Otherwise, we create a temporary stack to size for `constrainedWidth`.
/*if (CGRectGetWidth(components.textView.threadSafeBounds) != constrainedWidth)*/ { if (CGRectGetWidth(components.textView.threadSafeBounds) != constrainedWidth) {
components = [ASTextKitComponents componentsWithAttributedSeedString:components.textStorage textContainerSize:CGSizeMake(constrainedWidth, CGFLOAT_MAX)]; components = [ASTextKitComponents componentsWithAttributedSeedString:components.textStorage textContainerSize:CGSizeMake(constrainedWidth, CGFLOAT_MAX)];
} }