File tree Expand file tree Collapse file tree 1 file changed +16
-11
lines changed Expand file tree Collapse file tree 1 file changed +16
-11
lines changed Original file line number Diff line number Diff line change @@ -517,6 +517,18 @@ static CGFloat YGRoundPixelValue(CGFloat value) {
517
517
return roundf (value * scale) / scale;
518
518
}
519
519
520
+ static CGPoint YGPointReplacingNanWithZero (CGPoint const value) {
521
+ CGPoint result = value;
522
+
523
+ if (isnan (result.x )) {
524
+ result.x = 0 ;
525
+ }
526
+ if (isnan (result.y )) {
527
+ result.y = 0 ;
528
+ }
529
+ return result;
530
+ }
531
+
520
532
static void YGApplyLayoutToViewHierarchy (UIView* view, BOOL preserveOrigin) {
521
533
NSCAssert (
522
534
[NSThread isMainThread ],
@@ -529,22 +541,15 @@ static void YGApplyLayoutToViewHierarchy(UIView* view, BOOL preserveOrigin) {
529
541
}
530
542
531
543
YGNodeRef node = yoga.node ;
532
- const CGPoint topLeft = {
544
+ const CGPoint topLeft = YGPointReplacingNanWithZero ( {
533
545
YGNodeLayoutGetLeft (node),
534
546
YGNodeLayoutGetTop (node),
535
- };
547
+ }) ;
536
548
537
- CGPoint bottomRight = {
549
+ const CGPoint bottomRight = YGPointReplacingNanWithZero ( {
538
550
topLeft.x + YGNodeLayoutGetWidth (node),
539
551
topLeft.y + YGNodeLayoutGetHeight (node),
540
- };
541
-
542
- if (isnan (bottomRight.x )) {
543
- bottomRight.x = 0 ;
544
- }
545
- if (isnan (bottomRight.y )) {
546
- bottomRight.y = 0 ;
547
- }
552
+ });
548
553
549
554
const CGPoint origin = preserveOrigin ? view.frame .origin : CGPointZero;
550
555
view.frame = (CGRect){
You can’t perform that action at this time.
0 commit comments