Skip to content

Commit a7f376b

Browse files
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.
2 parents 99c2907 + 8173d95 commit a7f376b

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

lib/svg/generator.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ function renderFooter(
337337
x="${s(100)}"
338338
y="${s(80)}"
339339
width="${s(400)}"
340-
height="${sf}"
340+
height="${s(1)}"
341341
class="cp-accent-fill scan-line"
342342
fill-opacity="0.3"
343343
style="--scan-speed: ${params.speed || '8s'}; --scan-start: ${s(0)}px; --scan-end: ${s(240)}px;"
@@ -588,7 +588,7 @@ ${
588588
x="${s(100)}"
589589
y="${s(80)}"
590590
width="${s(400)}"
591-
height="${sf}"
591+
height="${s(1)}"
592592
class="cp-accent-fill scan-line"
593593
fill-opacity="0.3"
594594
style="--scan-speed: ${params.speed || '8s'}; --scan-start: ${s(0)}px; --scan-end: ${s(240)}px;"

0 commit comments

Comments
 (0)