Skip to content
This repository was archived by the owner on Feb 2, 2023. It is now read-only.
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions AsyncDisplayKit/ASDisplayNode.mm
Original file line number Diff line number Diff line change
Expand Up @@ -1705,14 +1705,17 @@ - (void)layout
}

// Assume that _layout was flattened and is 1-level deep.
ASDisplayNode *subnode = nil;
CGRect subnodeFrame = CGRectZero;
for (ASLayout *subnodeLayout in _layout.sublayouts) {
ASDisplayNodeAssert([_subnodes containsObject:subnodeLayout.layoutableObject], @"Cached sublayouts must only contain subnodes' layout.");
subnodeFrame.origin = subnodeLayout.position;
subnodeFrame.size = subnodeLayout.size;
subnode = ((ASDisplayNode *)subnodeLayout.layoutableObject);
[subnode setFrame:subnodeFrame];
CGRect subnodeFrame = (CGRect){ subnodeLayout.position, subnodeLayout.size };
ASDisplayNode *subnode = ((ASDisplayNode *)subnodeLayout.layoutableObject);

CGPoint origin = subnode.bounds.origin;
CGPoint anchorPoint = subnode.anchorPoint;

subnode.bounds = (CGRect){ origin, subnodeFrame.size };
subnode.position = CGPointMake(subnodeFrame.origin.x + subnodeFrame.size.width * anchorPoint.x,
subnodeFrame.origin.y + subnodeFrame.size.height * anchorPoint.y);
}
}

Expand Down