Round pixel values of intrinsicSize
with YGRoundPixelValue
#1213
Reference in New Issue
Block a user
No description provided.
Delete Branch "patch-yogakit-intrinsicsize-with-ygroundpixelvalue"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This PR makes
intrinsicSize
return rounded pixel values usingYGRoundPixelValue
asYGApplyLayoutToViewHierarchy
does.This change prevents text truncation due to the low precision of C++
float
when sizing the view containingUILabel
usingintinsicSize
.Change makes sense to me.
For record-keeping, could you add a before/after screenshot to the PR description?
For awareness, the automated tests for YogaKit, and build on latest toolchain have been broken for a while, so we will have reduced coverage for this change against any existing automated tests.
Fixing that has been on the infrastructure todo list, but after fixing the CMake + GTest experience for C ++ UTs, and then UTs for JNI bindings/Android build. There are a lot of PRs fixing various bits of the Apple build, but I haven't had the experience with the ecosystem to understand the whole of what we should be doing to the existing build logic, vs if we should just axe it, follow the Cocoapods/SPM guide for building a new package + example, then follow the leads where it needs code-changes.
Perhaps I'm missing something here, but as I understand, Yoga already returns values rounded to the pixel grid assuming you set the scale via YGConfigSetPointScaleFactor. Why do you need to round a value that should presumably already be rounded?
See comments from Eric, and request for test plan
Just to check, is the idea here that:
YGRoundToPixelGrid()
) based onpointScaleFactor
, when laying out a node.YGRoundPixelValue()
and its usage should be removed, and we should rely on Yoga to do all of the rounding itselfI am seeing that YogaKit is already calling
YGConfigSetPointScaleFactor()
(though assuming the density never changes, which is... probably fine on iOS). So this would end up looking like just removing the existing usage I think.We are deprecating YogaKit as part of the Yoga 2.0 release. We are still going to release a new revision based on the current state of the repo, but won't be accepting new contributions, since we are going to be removing it from the repo after.
Pull request closed