World overlay: the distance curve is computed in the projection pass, so its result is never boxed

On Node 26 the engine inlined the projection pass's helpers in another order and left distanceScale out, so every label's paint scale allocated a number: 158 B per candidate per frame against the 154 B budget, where main measures 136 B. The curve now sits beside the altitude curve in snapshotAndProject, with the same arithmetic.
This commit is contained in:
Sameh Khamis committed 2026-11-15 20:12:14 -08:00
1 parent 256e992372
commit 74673f3c85
1 file changed
+19 -3
+19 -3
View File
@@ -1968,9 +1968,25 @@ function snapshotAndProject(entry, source, viewProjection, keyhole) {
: 0
: distanceFade(distance, record.distanceOptions);
const cameraAltitude = _eyeHeight;
record.paintScale = entry.distanceScale
? distanceScale(distance, entry.distanceScale)
: 1;
// The distance curve is local for the same reason as the altitude curve
// below: through a helper the engine may not inline, its result is boxed.
// `entry.distanceScale` was normalized when the entry was registered.
const scaleCurve = entry.distanceScale;
if (!scaleCurve || !Number.isFinite(distance)) {
record.paintScale = 1;
} else if (
distance <= scaleCurve.near ||
scaleCurve.far === scaleCurve.near
) {
record.paintScale = scaleCurve.nearValue;
} else if (distance >= scaleCurve.far) {
record.paintScale = scaleCurve.farValue;
} else {
record.paintScale =
scaleCurve.nearValue +
(scaleCurve.farValue - scaleCurve.nearValue) *
((distance - scaleCurve.near) / (scaleCurve.far - scaleCurve.near));
}
// Keep the source-configurable piecewise curve local to the projection hot
// path. Passing its five doubles through a non-inlined helper boxed them for
// every thumbnail candidate and broke the shared 154 B/candidate gate.