Skip to content

Commit 07d3bf9

Browse files
committed
Merge branch 'master' of github.com:lucmirego/FlexLayout
2 parents 8966c74 + f6a261c commit 07d3bf9

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

Sources/YogaKit/YGLayout.mm

+10-4
Original file line numberDiff line numberDiff line change
@@ -502,11 +502,17 @@ static void YGApplyLayoutToViewHierarchy(UIView *view, BOOL preserveOrigin)
502502
YGNodeLayoutGetLeft(node),
503503
YGNodeLayoutGetTop(node),
504504
};
505-
506-
const CGPoint bottomRight = {
505+
CGPoint bottomRight = {
507506
topLeft.x + YGNodeLayoutGetWidth(node),
508507
topLeft.y + YGNodeLayoutGetHeight(node),
509508
};
509+
510+
if (isnan(bottomRight.x)) {
511+
bottomRight.x = 0;
512+
}
513+
if (isnan(bottomRight.y)) {
514+
bottomRight.y = 0;
515+
}
510516

511517
const CGPoint origin = preserveOrigin ? view.frame.origin : CGPointZero;
512518
view.frame = (CGRect) {
@@ -515,8 +521,8 @@ static void YGApplyLayoutToViewHierarchy(UIView *view, BOOL preserveOrigin)
515521
.y = YGRoundPixelValue(topLeft.y + origin.y),
516522
},
517523
.size = {
518-
.width = YGRoundPixelValue(bottomRight.x) - YGRoundPixelValue(topLeft.x),
519-
.height = YGRoundPixelValue(bottomRight.y) - YGRoundPixelValue(topLeft.y),
524+
.width = MAX(0, YGRoundPixelValue(bottomRight.x) - YGRoundPixelValue(topLeft.x)),
525+
.height = MAX(0, YGRoundPixelValue(bottomRight.y) - YGRoundPixelValue(topLeft.y)),
520526
},
521527
};
522528

0 commit comments

Comments
 (0)