mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 06:35:51 +00:00
Stopped trying to cache the currentScaleFactor
Was running into issues where the scale factor would get cleared when setting a new atributedString on a textNode. I was clearing out the currentScaleFactor when setting an attributedString into a textNode. It appears that `_calculateSize` isn't always called when setting a new string into a ASTextNode. It can be the case that only `drawInContext:bounds:` is called. With _currentScaleFactor cleared out the renderer that calls`drawInContext...` was being called with a scaleFactor of 0. It could be the case that the fix could be to remove the clearing of `currentScaleFactor` from `setAttributedString`, but this seems like a safer fix to me. It does, however, require an extra run through the font adjuster when enabled.
This commit is contained in:
@@ -86,10 +86,6 @@ struct ASTextKitAttributes {
|
||||
An array of scale factors in descending order to apply to the text to try to make it fit into a constrained size.
|
||||
*/
|
||||
NSArray *pointSizeScaleFactors;
|
||||
/**
|
||||
The currently applied scale factor. Only valid if pointSizeScaleFactors are provided. Defaults to 0 (no scaling)
|
||||
*/
|
||||
CGFloat currentScaleFactor;
|
||||
/**
|
||||
An optional block that returns a custom layout manager subclass. If nil, defaults to NSLayoutManager.
|
||||
*/
|
||||
@@ -123,7 +119,6 @@ struct ASTextKitAttributes {
|
||||
shadowOpacity,
|
||||
shadowRadius,
|
||||
pointSizeScaleFactors,
|
||||
currentScaleFactor,
|
||||
layoutManagerCreationBlock,
|
||||
layoutManagerDelegate,
|
||||
textStorageCreationBlock,
|
||||
@@ -138,7 +133,6 @@ struct ASTextKitAttributes {
|
||||
&& shadowOpacity == other.shadowOpacity
|
||||
&& shadowRadius == other.shadowRadius
|
||||
&& [pointSizeScaleFactors isEqualToArray:other.pointSizeScaleFactors]
|
||||
&& currentScaleFactor == currentScaleFactor
|
||||
&& layoutManagerCreationBlock == other.layoutManagerCreationBlock
|
||||
&& textStorageCreationBlock == other.textStorageCreationBlock
|
||||
&& CGSizeEqualToSize(shadowOffset, other.shadowOffset)
|
||||
|
||||
Reference in New Issue
Block a user