Skip to content

Commit 456523e

Browse files
authored
Merge pull request #210 from stleamist/patch-yogakit-intrinsicsize-with-ygroundpixelvalue
Round pixel values of `intrinsicSize` with `YGRoundPixelValue`
2 parents a91b1a0 + ed58f5c commit 456523e

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Sources/YogaKit/YGLayout.mm

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,11 +309,15 @@ - (void)applyLayoutPreservingOrigin:(BOOL)preserveOrigin dimensionFlexibility:(Y
309309

310310
- (CGSize)intrinsicSize
311311
{
312-
const CGSize constrainedSize = {
312+
CGSize constrainedSize = {
313313
.width = YGUndefined,
314314
.height = YGUndefined,
315315
};
316-
return [self calculateLayoutWithSize:constrainedSize];
316+
constrainedSize = [self calculateLayoutWithSize:constrainedSize];
317+
return (CGSize){
318+
.width = YGRoundPixelValue(constrainedSize.width),
319+
.height = YGRoundPixelValue(constrainedSize.height),
320+
};
317321
}
318322

319323
- (CGSize)calculateLayoutWithSize:(CGSize)size

0 commit comments

Comments
 (0)