mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-16 11:20:18 +00:00
fix bug: constraint size not updated for frontsizeadjuster
This commit is contained in:
parent
f696eb7476
commit
733c65d1eb
@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
@interface ASTextKitFontSizeAdjuster : NSObject
|
@interface ASTextKitFontSizeAdjuster : NSObject
|
||||||
|
|
||||||
|
@property (nonatomic, assign) CGSize constrainedSize;
|
||||||
|
|
||||||
- (instancetype)initWithContext:(ASTextKitContext *)context
|
- (instancetype)initWithContext:(ASTextKitContext *)context
|
||||||
minimumScaleFactor:(CGFloat)minimumScaleFactor
|
minimumScaleFactor:(CGFloat)minimumScaleFactor
|
||||||
|
|||||||
@ -13,7 +13,6 @@
|
|||||||
{
|
{
|
||||||
__weak ASTextKitContext *_context;
|
__weak ASTextKitContext *_context;
|
||||||
CGFloat _minimumScaleFactor;
|
CGFloat _minimumScaleFactor;
|
||||||
CGSize _constrainedSize;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (instancetype)initWithContext:(ASTextKitContext *)context
|
- (instancetype)initWithContext:(ASTextKitContext *)context
|
||||||
@ -28,7 +27,6 @@
|
|||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
- (CGSize)sizeForAttributedString:(NSAttributedString *)attrString
|
- (CGSize)sizeForAttributedString:(NSAttributedString *)attrString
|
||||||
{
|
{
|
||||||
return [attrString boundingRectWithSize:CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX)
|
return [attrString boundingRectWithSize:CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX)
|
||||||
|
|||||||
@ -125,11 +125,12 @@ static NSCharacterSet *_defaultAvoidTruncationCharacterSet()
|
|||||||
_sizeIsCalculated = NO;
|
_sizeIsCalculated = NO;
|
||||||
_constrainedSize = constrainedSize;
|
_constrainedSize = constrainedSize;
|
||||||
// If the context isn't created yet, it will be initialized with the appropriate size when next accessed.
|
// If the context isn't created yet, it will be initialized with the appropriate size when next accessed.
|
||||||
if (_context) {
|
if (_context || _fontSizeAdjuster) {
|
||||||
// If we're updating an existing context, make sure to use the same inset logic used during initialization.
|
// If we're updating an existing context, make sure to use the same inset logic used during initialization.
|
||||||
// This codepath allows us to reuse the
|
// This codepath allows us to reuse the
|
||||||
CGSize shadowConstrainedSize = [[self shadower] insetSizeWithConstrainedSize:constrainedSize];
|
CGSize shadowConstrainedSize = [[self shadower] insetSizeWithConstrainedSize:constrainedSize];
|
||||||
_context.constrainedSize = shadowConstrainedSize;
|
if (_context) _context.constrainedSize = shadowConstrainedSize;
|
||||||
|
if (_fontSizeAdjuster) _fontSizeAdjuster.constrainedSize = shadowConstrainedSize;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user