aminghadersohi commented on PR #44321:
URL: https://github.com/apache/superset/pull/44321#issuecomment-5903258446
Thanks @rebenitez1802 — addressed all three low-severity asks from your
approval review:
1. **Measurement forked from `measureTextWidth`** → 0a179f7dde. Added a
`measureTextInkWidth` sibling in `utils/series.ts`. It shares a single
context/font setup (`getTextMeasureContext`) and SSR estimate
(`estimateTextWidth`, with the `0.62` ratio as one named constant) with
`measureTextWidth`, so the font string and fallback ratio exist in one place
only. Gantt calls the helper and no longer keeps its own canvas block. The
legend path still returns the same advance width and keeps its cache. I also
fixed the stale cache comment that said Gantt shared the legend cache.
2. **"descenders" cited as a horizontal overhang** → source comment fixed in
0a179f7dde, test comment fixed in 658698af3a. Both now say "italics, or glyphs
whose ink overhangs the pen advance".
3. **`?? 0` / no-canvas fallbacks not value-asserted** → 0a179f7dde adds
`measureTextInkWidth` unit tests covering: ink extent wins, advance width wins,
only `{ width }` returned (returns `width`, not `NaN`), `getContext` → `null`
(returns `length * fontSizeSM * 0.62`), and the font string. 658698af3a adds
Gantt-level tests: with no bounding-box metrics, `grid.left` is identical to
the metrics-present run and is not `NaN`; with no canvas, the reserved label
width equals the approximate width.
Gantt + `utils/series` jest suites: 3 suites / 139 tests pass. Frontend type
check and lint/format hooks pass on the changed files.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]