Commit a7f376b
authored
Fix: use scaler for scan-line rect height in SVG generator (JhaSourav07#1599)
## Description
Fixes JhaSourav07#1597
This PR fixes an SVG rendering issue where the scan-line rectangle
height was using the raw size scale factor (`sf`) instead of the
renderer scaler.
Previously, the scan-line height was rendered as:
```ts
height="${sf}"
```
This could produce fractional values (e.g. `0.667`, `1.333`) for
non-default badge sizes, leading to inconsistent rendering across
browsers and SVG viewers.
### Changes Made
* Replaced `height="${sf}"` with `height="${s(1)}"` in:
* `generateSVG()`
* `generateAutoThemeSVG()`
* Ensured scan-line height is calculated using the renderer scaler and
expressed in pixel units.
* Aligned scan-line rendering behavior with the `notFound` renderer
implementation.
### Result
* Consistent scan-line rendering across all badge sizes.
* Eliminates fractional height values that could cause visual artifacts
or disappearing scan lines.
* Maintains existing animation and theme behavior.
## Pillar
* [ ] 🎨 Pillar 1 — New Theme Design
* [x] 📐 Pillar 2 — Geometric SVG Improvement
* [ ] 🕐 Pillar 3 — Timezone Logic Optimization
* [ ] 🛠️ Other (Bug fix, refactoring, docs)
Manual verification performed:
* Generated badges using `size=small`, `size=medium`, and `size=large`
* Confirmed scan-line height is generated via `s(1)`
* Verified scan-line renders consistently across sizes
* Confirmed animations and CSS variables remain unchanged
## Checklist before requesting a review:
* [x] I have read the `CONTRIBUTING.md` file.
* [x] I have tested these changes locally
(`localhost:3000/api/streak?user=YOUR_USERNAME`).
* [x] I have run `npm run format` and `npm run lint` locally and
resolved all errors (CI will fail otherwise).
* [x] My commits follow the Conventional Commits format (e.g.,
`feat(themes): ...`, `fix(calculate): ...`).
* [ ] I have updated `README.md` if I added a new theme or URL
parameter.
* [x] I have starred the repo.
* [x] I have made sure that I have only one commit to merge in this PR.
* [x] The SVG output matches the CommitPulse "premium quality" aesthetic
standard (no raw elements, smooth animations, correct fonts).
* [ ] (Recommended) I joined the CommitPulse Discord community for
contributor discussions, mentorship, and faster PR support.1 file changed
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
337 | 337 | | |
338 | 338 | | |
339 | 339 | | |
340 | | - | |
| 340 | + | |
341 | 341 | | |
342 | 342 | | |
343 | 343 | | |
| |||
588 | 588 | | |
589 | 589 | | |
590 | 590 | | |
591 | | - | |
| 591 | + | |
592 | 592 | | |
593 | 593 | | |
594 | 594 | | |
| |||
0 commit comments