Skip to content

fix(docs): center and auto-fit mermaid SVG to fullscreen on open#137

Merged
JusterZhu merged 2 commits into
mainfrom
docs/core-execution-flow
Jun 21, 2026
Merged

fix(docs): center and auto-fit mermaid SVG to fullscreen on open#137
JusterZhu merged 2 commits into
mainfrom
docs/core-execution-flow

Conversation

@JusterZhu

Copy link
Copy Markdown
Collaborator

Problem

PR #136 added click-to-zoom, but the SVG rendered small in the top-left corner of the modal instead of filling the screen.

Fix

  • Modal now covers the full viewport (100vw x 100vh)
  • On open, auto-scale the SVG to fill available space using viewBox dimensions
  • SVG is horizontally and vertically centered
  • Window resize triggers re-fit in real time
  • Added a Fit to screen button (+ keyboard shortcut 0) to re-center after manual pan/zoom
  • Remove leftover horizontal-scroll CSS from PR feat(docs): add horizontal scroll + zoom interaction for mermaid flowcharts #135

Before

SVG rendered at tiny native size in a small box

After

SVG fills the entire screen, centered, with the same zoom/pan/drag interactions

🤖 Generated with Claude Code

JusterZhu and others added 2 commits June 21, 2026 14:19
Replace the basic scrollbar approach with a full interactive viewer:
- Click any mermaid diagram to open a fullscreen modal overlay
- Pan (drag) and zoom (scroll/+/- buttons) to freely explore
- Toolbar with zoom in/out/reset/close buttons
- Escape key to close, +/=/- keyboard shortcuts
- Dark/light theme support
- Smooth overlay animation

Co-Authored-By: Claude <noreply@anthropic.com>
Previously the modal body was only 90vw x 85vh with nested scrollable
divs, and the SVG rendered at its tiny native size in the top-left corner.

Fixes:
- Modal now covers the entire viewport (100vw x 100vh)
- On open, auto-scale SVG to fit available space using viewBox dimensions
- SVG is centered both horizontally and vertically
- Window resize also re-fits the SVG
- Replaced the old 'reset' button with a 'fit to screen' button (0)
- Keyboard shortcut 0 to re-fit

Co-Authored-By: Claude <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 21, 2026 06:20

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@JusterZhu JusterZhu merged commit f4570b1 into main Jun 21, 2026
2 checks passed
@JusterZhu JusterZhu deleted the docs/core-execution-flow branch June 21, 2026 06:23
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.

2 participants