From 7505a6fc2d63d9588b296039b04a695e5598bbf7 Mon Sep 17 00:00:00 2001 From: Bela Bohlender Date: Mon, 11 Nov 2024 21:14:51 +0100 Subject: [PATCH] workarround for yoga issue 1651 --- packages/uikit/src/flex/node.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/uikit/src/flex/node.ts b/packages/uikit/src/flex/node.ts index 2b4f1766..2b74b255 100644 --- a/packages/uikit/src/flex/node.ts +++ b/packages/uikit/src/flex/node.ts @@ -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()