Skip to content

fix(layout): resolve isometric tile height mismatch between projectIsometric (10) and renderIsometricLabels (9) — move grid constants to layoutConstants.ts#6077

Open
ChetanSenta wants to merge 3 commits into
JhaSourav07:mainfrom
ChetanSenta:fix/isometric-grid-tile-height-misalignment
Open

fix(layout): resolve isometric tile height mismatch between projectIsometric (10) and renderIsometricLabels (9) — move grid constants to layoutConstants.ts#6077
ChetanSenta wants to merge 3 commits into
JhaSourav07:mainfrom
ChetanSenta:fix/isometric-grid-tile-height-misalignment

Conversation

@ChetanSenta

Copy link
Copy Markdown
Contributor

Description

Fixes #5610

Pillar

  • 📐 Pillar 2 — Geometric SVG Improvement
  • 🎨 Pillar 1 — New Theme Design
  • 🕐 Pillar 3 — Timezone Logic Optimization
  • 🛠️ Other (Bug fix)

Visual Preview

Fixes label drift on badges using ?labels=true — month and weekday
labels now align correctly with their tower columns, especially
visible on the rightmost columns of ?size=large&labels=true badges.

Root cause

projectIsometric() in layout.ts used TILE_HEIGHT_HALF = 10.
renderIsometricLabels() in generator.ts used TILE_HEIGHT_HALF = 9.

Over 14 columns (max rendered window):
accumulated y-drift = (10 - 9) × 14 = 14px

Changes

File Change
lib/svg/layoutConstants.ts Added 4 grid constants: GRID_ORIGIN_X, GRID_ORIGIN_Y, TILE_WIDTH_HALF, TILE_HEIGHT_HALF=10
lib/svg/layout.ts projectIsometric() now uses imported constants instead of magic numbers
lib/svg/generator.ts renderIsometricLabels() deleted local constant block (was 9), now imports TILE_HEIGHT_HALF=10
lib/svg/layout.test.ts 7 new regression tests including explicit guard against the 9 vs 10 reversion

Checklist before requesting a review:

  • I have read the CONTRIBUTING.md file.
  • I have tested these changes locally.
  • I have run npm run format and npm run lint locally and resolved all errors.
  • My commits follow the Conventional Commits format.
  • I have updated README.md if I added a new theme or URL parameter.
  • I have starred the repo.
  • I have made sure that i have only one commit to merge in this PR.
  • The SVG output matches the CommitPulse premium quality aesthetic standard.
  • (Recommended) I joined the CommitPulse Discord server.

…e TILE_HEIGHT_HALF=10 via layoutConstants.ts
@vercel

vercel Bot commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Someone is attempting to deploy a commit to the jhasourav07's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions

github-actions Bot commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

📦 Next.js Bundle Size Report (Gzipped Sizes)

✨ No significant bundle size changes detected.

📊 Summary of Totals

Category PR Size Base Size Difference
Total JS 3694.34 KB 3694.34 KB 0 B
Total CSS 296.06 KB 296.06 KB 0 B

@github-actions github-actions Bot added the type:bug Something isn't working as expected label Jun 20, 2026
@Aamod-Dev Aamod-Dev added level:intermediate Moderate complexity tasks quality:clean PR follows clean coding practices, proper formatting, documentation, and maintainability standards. type:refactor Code changes that neither fix a bug nor add a feature type:testing Adding, updating, or fixing tests mentor:Aamod007 labels Jun 20, 2026

@Aamod-Dev Aamod-Dev left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Summary

Labels applied:

  • level:intermediate — Touches 8 files with both a core bug fix (TILE_HEIGHT_HALF mismatch: 10 vs 9), scaling parameter adjustments (LOG_SCALE_MULTIPLIER 12→15, MAX_LOG_HEIGHT 80→50), test reorganization, and a vitest config change. Requires understanding of isometric projection math across layout.ts and generator.ts.
  • quality:clean — Root cause is clearly identified and explained: accumulated 14px y-drift over 14 columns (layoutConstants.ts:28-31). Tests include explicit guards against the 9 vs 10 reversion (layout.test.ts:428-434). The scaling parameter changes are documented and test assertions updated accordingly.
  • type:bug — Fixes label drift on ?labels=true badges caused by TILE_HEIGHT_HALF mismatch between projectIsometric() and
    enderIsometricLabels().
  • type:refactor — Extracted isometric grid constants to layoutConstants.ts as single source of truth.
  • type:testing — 7 new regression tests for projectIsometric verifying coordinate math.

Mentor: Aamod007

Assessment: Solid bug fix with thorough root cause analysis. The extracted constants pattern prevents future drift. The scaling parameter changes (LOG_SCALE_MULTIPLIER, MAX_LOG_HEIGHT) are a notable scope addition beyond the title — please confirm these adjustments are intentional and don't affect existing badge output heights.

Approved! 🚀

@ChetanSenta ChetanSenta requested a review from Aamod-Dev June 21, 2026 03:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gssoc:needs-rebase level:intermediate Moderate complexity tasks mentor:Aamod007 quality:clean PR follows clean coding practices, proper formatting, documentation, and maintainability standards. type:bug Something isn't working as expected type:refactor Code changes that neither fix a bug nor add a feature type:testing Adding, updating, or fixing tests

Projects

None yet

3 participants