glideapps / glideapps/glide-data-grid
possible bug in packages/core/src/internal/data-grid/render/data-grid-render.header.ts
- Dominant language
- TypeScript
- Stars
- 5.3k
- Forks
- 428
- PR merge metrics
- No merged PRs in 30d
Description
I'm using the new alpha code for the header indicator icon, and also I've modified the code a bit to support right alignment (not rtl, just normal ltr but right aligned within the header cell) of the header text, and to support wrapping the text onto 2 lines.
Anyway while working on that I realized in this code at line 382 where it computes textBounds.width, the calculation was sometimes returning negative numbers, which I assume is incorrect. I modified it my version to:
`width: (x + width) - drawX - xPad`
That seems to generate better results.
Also the code just below there at line 392 which modifies textBounds.width in the case of a header indicator icon, I was sometimes seeing the new width set to too low of a number. I didn't have time to trace that all the way back to see what was happening, I changed mine to:
```
textBounds.width -= headerIconSize + xPad;
drawX += textBounds.width + xPad;
```
Contributor guide
Assessment
This issue has not been assessed yet.