Skip to content

Commit

Permalink
workarround for yoga issue 1651
Browse files Browse the repository at this point in the history
  • Loading branch information
bbohlender committed Nov 11, 2024
1 parent 5b2848b commit 7505a6f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/uikit/src/flex/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -323,8 +323,10 @@ export function setMeasureFunc(node: Node, func: MeasureFunction | undefined) {
node.setMeasureFunc((width, wMode, height, hMode) => {
const result = func(width, wMode, height, hMode)
return {
width: Math.ceil(result.width * PointScaleFactor + 1) / PointScaleFactor,
height: Math.ceil(result.height * PointScaleFactor + 1) / PointScaleFactor,
//why + 2? we use a offset of + 1 to prevent precision errors but + 1 causes the following issue in yoga with the default pixelSize of 0.01 therefore +2
//https://github.com/facebook/yoga/issues/1651
width: Math.ceil(result.width * PointScaleFactor + 2) / PointScaleFactor,
height: Math.ceil(result.height * PointScaleFactor + 2) / PointScaleFactor,
}
})
node.markDirty()
Expand Down

0 comments on commit 7505a6f

Please sign in to comment.