Fix negative value rounding issue for nodes across an axis #688

Open
jmaurice-unity wants to merge 3 commits from jmaurice-unity/rounding-nodes-shrink into main
795 changed files with 45742 additions and 75220 deletions
Showing only changes of commit 70369ae5d3 - Show all commits

View File

@@ -3015,13 +3015,12 @@ float YGRoundValueToPixelGrid(const float value,
scaledValue = scaledValue - fractial + 1.0;
} else if (forceCeil) {
// Next we check if we need to use forced rounding
scaledValue = scaledValue - fractial + 1.0f;
scaledValue = ceilf(scaledValue);
} else if (forceFloor) {
scaledValue = scaledValue - fractial;
scaledValue = floorf(scaledValue);
} else {
// Finally we just round the value
scaledValue = scaledValue - fractial +
(fractial > 0.5f || YGFloatsEqual(fractial, 0.5f) ? 1.0f : 0.0f);
scaledValue = roundf(scaledValue);
}
return scaledValue / pointScaleFactor;
}