This commit is contained in:
ricky cancro
2015-08-12 15:29:26 -07:00
parent b4e6591ad8
commit 3bc692c938
2 changed files with 5 additions and 2 deletions

View File

@@ -186,8 +186,10 @@ typedef CALayer *(^ASDisplayNodeLayerBlock)();
@property (nonatomic, readonly, assign) ASSizeRange constrainedSizeForCalculatedLayout; @property (nonatomic, readonly, assign) ASSizeRange constrainedSizeForCalculatedLayout;
/** /**
* @abstract Used by some implementations of measureWithSizeRange: to provide an intrisic content size * @abstract Provides a default intrinsic content size for calculateSizeThatFits:. This is useful when laying out
* to a node when one cannot be computed from its subnodes * a node that either has no intrinsic content size or should be laid out at a different size than its intrinsic content
* size. For example, this property could be set on an ASImageNode to display at a size different from the underlying
* image size.
* *
* @return The preferred frame size of this node * @return The preferred frame size of this node
*/ */

View File

@@ -111,6 +111,7 @@
- (CGSize)calculateSizeThatFits:(CGSize)constrainedSize - (CGSize)calculateSizeThatFits:(CGSize)constrainedSize
{ {
ASDN::MutexLocker l(_imageLock); ASDN::MutexLocker l(_imageLock);
// if a preferredFrameSize is set, call the superclass to return that instead of using the image size.
if (CGSizeEqualToSize(self.preferredFrameSize, CGSizeZero) == NO) if (CGSizeEqualToSize(self.preferredFrameSize, CGSizeZero) == NO)
return [super calculateSizeThatFits:constrainedSize]; return [super calculateSizeThatFits:constrainedSize];
else if (_image) else if (_image)