mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-24 07:05:35 +00:00
Add expectedSize to ASNetworkImageNode
ASNetworkImageNode defers to ASImageNode to return its calculatedSize. ASImageNode returns the size of its image. There is a good chance that ASNetworkImageNode hasn't downloaded its image yet when calculatedSize is called, so it returns a size of CGSizeZero. On top of that, it is possible that the size of the image is not actually the size that we wish to display in our node. I've added an "expectedImageSize" property that can be used to determine the calculatedSize of an ASNetworkImageNode.
This commit is contained in:
@@ -111,7 +111,9 @@
|
||||
- (CGSize)calculateSizeThatFits:(CGSize)constrainedSize
|
||||
{
|
||||
ASDN::MutexLocker l(_imageLock);
|
||||
if (_image)
|
||||
if (CGSizeEqualToSize(self.preferredFrameSize, CGSizeZero) == NO)
|
||||
return CGSizeMake(MIN(constrainedSize.width, self.preferredFrameSize.width), MIN(constrainedSize.height, self.preferredFrameSize.height));
|
||||
else if (_image)
|
||||
return _image.size;
|
||||
else
|
||||
return CGSizeZero;
|
||||
|
||||
Reference in New Issue
Block a user