Skip to content

Commit

Permalink
Merge pull request #210 from stleamist/patch-yogakit-intrinsicsize-wi…
Browse files Browse the repository at this point in the history
…th-ygroundpixelvalue

Round pixel values of `intrinsicSize` with `YGRoundPixelValue`
  • Loading branch information
lucdion authored Jan 20, 2023
2 parents a91b1a0 + ed58f5c commit 456523e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Sources/YogaKit/YGLayout.mm
Original file line number Diff line number Diff line change
Expand Up @@ -309,11 +309,15 @@ - (void)applyLayoutPreservingOrigin:(BOOL)preserveOrigin dimensionFlexibility:(Y

- (CGSize)intrinsicSize
{
const CGSize constrainedSize = {
CGSize constrainedSize = {
.width = YGUndefined,
.height = YGUndefined,
};
return [self calculateLayoutWithSize:constrainedSize];
constrainedSize = [self calculateLayoutWithSize:constrainedSize];
return (CGSize){
.width = YGRoundPixelValue(constrainedSize.width),
.height = YGRoundPixelValue(constrainedSize.height),
};
}

- (CGSize)calculateLayoutWithSize:(CGSize)size
Expand Down

0 comments on commit 456523e

Please sign in to comment.