mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 06:35:51 +00:00
Homogenize cell node measuring
This commit is contained in:
@@ -103,6 +103,12 @@ static void *kASSizingQueueContext = &kASSizingQueueContext;
|
|||||||
|
|
||||||
#pragma mark - Cell Layout
|
#pragma mark - Cell Layout
|
||||||
|
|
||||||
|
- (void)_layoutNode:(ASCellNode *)node withConstrainedSize:(ASSizeRange)constrainedSize
|
||||||
|
{
|
||||||
|
[node measureWithSizeRange:constrainedSize];
|
||||||
|
node.frame = CGRectMake(0.0f, 0.0f, node.calculatedSize.width, node.calculatedSize.height);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* FIXME: Shouldn't this method, as well as `_layoutNodes:atIndexPaths:withAnimationOptions:` use the word "measure" instead?
|
* FIXME: Shouldn't this method, as well as `_layoutNodes:atIndexPaths:withAnimationOptions:` use the word "measure" instead?
|
||||||
*
|
*
|
||||||
@@ -116,8 +122,7 @@ static void *kASSizingQueueContext = &kASSizingQueueContext;
|
|||||||
ASCellNode *node = nodes[idx];
|
ASCellNode *node = nodes[idx];
|
||||||
if (node.isNodeLoaded) {
|
if (node.isNodeLoaded) {
|
||||||
ASSizeRange constrainedSize = [self constrainedSizeForNodeOfKind:ASDataControllerRowNodeKind atIndexPath:indexPath];
|
ASSizeRange constrainedSize = [self constrainedSizeForNodeOfKind:ASDataControllerRowNodeKind atIndexPath:indexPath];
|
||||||
[node measureWithSizeRange:constrainedSize];
|
[self _layoutNode:node withConstrainedSize:constrainedSize];
|
||||||
node.frame = CGRectMake(0.0f, 0.0f, node.calculatedSize.width, node.calculatedSize.height);
|
|
||||||
}
|
}
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
@@ -173,9 +178,7 @@ static void *kASSizingQueueContext = &kASSizingQueueContext;
|
|||||||
// Only measure nodes whose views aren't loaded, since we're in the background.
|
// Only measure nodes whose views aren't loaded, since we're in the background.
|
||||||
// We should already have measured loaded nodes before we left the main thread, using _layoutNodesWithMainThreadAffinity:
|
// We should already have measured loaded nodes before we left the main thread, using _layoutNodesWithMainThreadAffinity:
|
||||||
if (!node.isNodeLoaded) {
|
if (!node.isNodeLoaded) {
|
||||||
ASSizeRange constrainedSize = nodeBoundSizes[k];
|
[self _layoutNode:node withConstrainedSize:nodeBoundSizes[k]];
|
||||||
[node measureWithSizeRange:constrainedSize];
|
|
||||||
node.frame = CGRectMake(0.0f, 0.0f, node.calculatedSize.width, node.calculatedSize.height);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user