FlexLayout icon indicating copy to clipboard operation
FlexLayout copied to clipboard

The line pixel error

Open hayounghoon opened this issue 4 years ago • 0 comments

We try to make an application with the FlexLayout. The error occurs from the gap between Yoga library calculated value and the actual value for a UIView.

In a case...

In Yoga.cpp, func YGNodelayoutImpl() { ... } else if (alignItem == YGAlignCenter) { //leadingCrossDim += round(remainingCrossDim / 2); //Try to fix leadingCrossDim += remainingCrossDim / 2; } else { ... }

the remainingCrossDim is 37.5 remainingCrossDim / 2 is "18.75"

In YGLayout.mm func YGApplyLayoutToViewHierarchy() { ...

const CGPoint origin = preserveOrigin ? view.frame.origin : CGPointZero; view.frame = (CGRect) { .origin = { .x = YGRoundPixelValue(topLeft.x + origin.x), .y = YGRoundPixelValue(topLeft.y + origin.y), }, .size = { .width = YGRoundPixelValue(bottomRight.x) - YGRoundPixelValue(topLeft.x), .height = YGRoundPixelValue(bottomRight.y) - YGRoundPixelValue(topLeft.y), }, }; ... }

the topLeft.x returns "19"

The gap (between 18.75 and 19 = 0.25) makes the application view hidden in a case.

if we put the source below, the problem is solved. leadingCrossDim += round(remainingCrossDim / 2); //Try to fix

please check and confirm this.

스크린샷 2021-07-22 오전 9 04 03 스크린샷 2021-07-23 오전 8 56 01

hayounghoon avatar Jul 22 '21 23:07 hayounghoon