From 8dbc8b7df44a6dbf8c7732e705e0ad687fbcf494 Mon Sep 17 00:00:00 2001 From: rcancro Date: Wed, 24 Feb 2016 08:06:10 -0800 Subject: [PATCH] reordered conditionals, moved beta things to beta header file --- AsyncDisplayKit/ASTextNode+Beta.h | 12 ++++++++++++ AsyncDisplayKit/ASTextNode.h | 11 ----------- AsyncDisplayKit/TextKit/ASTextKitRenderer.mm | 4 ++-- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/AsyncDisplayKit/ASTextNode+Beta.h b/AsyncDisplayKit/ASTextNode+Beta.h index 38059aa7c3..5cf43aa5ad 100644 --- a/AsyncDisplayKit/ASTextNode+Beta.h +++ b/AsyncDisplayKit/ASTextNode+Beta.h @@ -15,4 +15,16 @@ */ @property (nonatomic, copy) NSArray *pointSizeScaleFactors; +#pragma mark - ASTextKit Customization +/** + A block to provide a hook to provide a custom NSLayoutManager to the ASTextKitRenderer + */ +@property (nonatomic, copy) NSLayoutManager * (^layoutManagerCreationBlock)(void); + +/** + A block to provide a hook to provide a NSTextStorage to the Text Kit's layout manager. + */ +@property (nonatomic, copy) NSTextStorage * (^textStorageCreationBlock)(NSAttributedString *attributedString); + + @end \ No newline at end of file diff --git a/AsyncDisplayKit/ASTextNode.h b/AsyncDisplayKit/ASTextNode.h index a1767edf63..f96bf51370 100644 --- a/AsyncDisplayKit/ASTextNode.h +++ b/AsyncDisplayKit/ASTextNode.h @@ -213,17 +213,6 @@ typedef NS_ENUM(NSUInteger, ASTextNodeHighlightStyle) { */ @property (nonatomic, assign) BOOL passthroughNonlinkTouches; -#pragma mark - ASTextKit Customization -/** - A block to provide a hook to provide a custom NSLayoutManager to the ASTextKitRenderer - */ -@property (nonatomic, copy) NSLayoutManager * (^layoutManagerCreationBlock)(void); - -/** - A block to provide a hook to provide a NSTextStorage to the Text Kit's layout manager. - */ -@property (nonatomic, copy) NSTextStorage * (^textStorageCreationBlock)(NSAttributedString *attributedString); - @end /** diff --git a/AsyncDisplayKit/TextKit/ASTextKitRenderer.mm b/AsyncDisplayKit/TextKit/ASTextKitRenderer.mm index 8bbe70ae2b..0fc6f5c5b3 100755 --- a/AsyncDisplayKit/TextKit/ASTextKitRenderer.mm +++ b/AsyncDisplayKit/TextKit/ASTextKitRenderer.mm @@ -139,7 +139,7 @@ static NSCharacterSet *_defaultAvoidTruncationCharacterSet() { [self truncater]; // if we have no scale factors or an unconstrained width, there is no reason to try to adjust the font size - if ([_attributes.pointSizeScaleFactors count] > 0 && isinf(_constrainedSize.width) == NO) { + if (isinf(_constrainedSize.width) == NO && [_attributes.pointSizeScaleFactors count] > 0) { _currentScaleFactor = [[self fontSizeAdjuster] scaleFactor]; } @@ -174,7 +174,7 @@ static NSCharacterSet *_defaultAvoidTruncationCharacterSet() ASDisplayNodeAssertNotNil(context, @"This is no good without a context."); // This renderer may not be the one that did the sizing. If that is the case its _currentScaleFactor will not be set, so we should compute it now - if ([_attributes.pointSizeScaleFactors count] > 0 && isinf(_constrainedSize.width) == NO && _sizeIsCalculated == NO) { + if (_sizeIsCalculated == NO && isinf(_constrainedSize.width) == NO && [_attributes.pointSizeScaleFactors count] > 0) { _currentScaleFactor = [[self fontSizeAdjuster] scaleFactor]; }