mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 14:20:20 +00:00
Animation and other improvements
This commit is contained in:
@@ -8,11 +8,29 @@
|
||||
//
|
||||
|
||||
#import <AsyncDisplayKit/ASTextKitComponents.h>
|
||||
#import "ASTextKitContext.h"
|
||||
#import <AsyncDisplayKit/ASAssert.h>
|
||||
#import <AsyncDisplayKit/ASMainThreadDeallocation.h>
|
||||
|
||||
#import <tgmath.h>
|
||||
|
||||
@implementation ASCustomTextContainer
|
||||
|
||||
- (CGRect)lineFragmentRectForProposedRect:(CGRect)proposedRect atIndex:(NSUInteger)characterIndex writingDirection:(NSWritingDirection)baseWritingDirection remainingRect:(nullable CGRect *)remainingRect {
|
||||
CGRect result = [super lineFragmentRectForProposedRect:proposedRect atIndex:characterIndex writingDirection:baseWritingDirection remainingRect:remainingRect];
|
||||
|
||||
/*if (result.origin.y < 10.0f) {
|
||||
result.size.width -= 20.0f;
|
||||
if (result.size.width < 0.0f) {
|
||||
result.size.width = 0.0f;
|
||||
}
|
||||
}*/
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@interface ASCustomLayoutManager : NSLayoutManager
|
||||
|
||||
@end
|
||||
@@ -118,7 +136,8 @@
|
||||
components.layoutManager = layoutManager;
|
||||
[components.textStorage addLayoutManager:components.layoutManager];
|
||||
|
||||
components.textContainer = [[NSTextContainer alloc] initWithSize:textContainerSize];
|
||||
components.textContainer = [[ASCustomTextContainer alloc] initWithSize:textContainerSize];
|
||||
//components.textContainer.exclusionPaths = @[[UIBezierPath bezierPathWithRect:CGRectMake(textContainerSize.width - 60.0, 0.0, 60.0, 40.0)]];
|
||||
components.textContainer.lineFragmentPadding = 0.0; // We want the text laid out up to the very edges of the text-view.
|
||||
[components.layoutManager addTextContainer:components.textContainer];
|
||||
|
||||
|
||||
@@ -50,4 +50,8 @@ AS_SUBCLASSING_RESTRICTED
|
||||
|
||||
@end
|
||||
|
||||
@interface ASCustomTextContainer : NSTextContainer
|
||||
|
||||
@end
|
||||
|
||||
#endif
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
[_textStorage setAttributedString:attributedString];
|
||||
}
|
||||
|
||||
_textContainer = [[NSTextContainer alloc] initWithSize:constrainedSize];
|
||||
_textContainer = [[ASCustomTextContainer alloc] initWithSize:constrainedSize];
|
||||
// We want the text laid out up to the very edges of the container.
|
||||
_textContainer.lineFragmentPadding = 0;
|
||||
_textContainer.lineBreakMode = lineBreakMode;
|
||||
|
||||
Reference in New Issue
Block a user