Skip to content

feat: fluid viewport canvas scaling and responsive hero margins - #76

Open
google-labs-jules[bot] wants to merge 1 commit into
mainfrom
jules/fluid-viewport-scaling-responsive-margins-c34ec38a-8890-46b9-a699-fa725f44b0c9
Open

feat: fluid viewport canvas scaling and responsive hero margins#76
google-labs-jules[bot] wants to merge 1 commit into
mainfrom
jules/fluid-viewport-scaling-responsive-margins-c34ec38a-8890-46b9-a699-fa725f44b0c9

Conversation

@google-labs-jules

Copy link
Copy Markdown
Contributor

Summary

This PR implements fluid viewport scaling for horizontal canvas drawing offsets and responsive hero overlay top spacing on the landing page.

Key Changes

  • Fluid Viewport Offset Scaling: Dynamic calculation of scaleFactor = Math.min(1, w / 1024) in +page.svelte canvas setup and resizeObserver. Horizontal offsets for both the bar chart and network graph elements scale dynamically based on active viewport width, ensuring canvas drawings render without passing through centered header text on viewports down to 320px width while preserving baseline desktop visual positioning at widths of 1024px and above.
  • Responsive Tailwind Margins: Replaced fixed inline offset (style="margin-top: 12rem;") on the hero text container with responsive utility classes (mt-16 sm:mt-24 md:mt-36 lg:mt-48). Top margins contract automatically on shorter screen heights (down to 560px), keeping primary navigation links unobstructed and easily targetable.
  • Resize Observer Recalculation: Scale factors and center positions automatically recalculate during window resize events for smooth transitions.
  • Unit Testing: Added src/routes/page.spec.ts verifying scale factor calculations across breakpoints and checking that responsive Tailwind margin utility classes are present without inline style overrides.

Verification

  • bun run check: 0 errors, 0 warnings.
  • bun run test: 16 passed, 61 passed tests.
  • bun run build: Built successfully.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants