feat(docs): rewrite mermaid modal with click-to-view, zoom buttons, and drag-to-scroll#140
Merged
Merged
Conversation
…nd drag-to-scroll Replace panzoom-based modal with a simpler, more reliable approach: - Click inline diagram to open a fullscreen modal - + / - buttons step through zoom levels (0.25x to 4x) - 1:1 reset button and current zoom % display - Drag-to-scroll (pan) via scrollLeft/scrollTop - Two-layer wrapper for correct scroll range after zoom * Outer: explicit px size = natural x scale (correct overflow) * Inner: transform:scale() fills the outer visually - Esc to close, locked body scroll - Dark theme support, grab cursor - Removes @panzoom/panzoom dependency Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR completely rewrites the mermaid diagram modal, replacing the panzoom-based approach that had persistent centering and scroll-range issues with a simpler, more reliable implementation.
The Problem
PRs #136--#138 added panzoom-based zoom/pan but had cascading issues:
transform: scale()didn't expand scroll range → content cut off after zoomcontain: 'outside'prevented zooming out from fit sizeThe Fix
Abandon panzoom entirely. Use native browser scroll + CSS transform:
+/-buttons stepping through 12 levels (0.25x--4x)scrollLeft/scrollTop(document-level mousemove tracking)transform: scale()to fill itEsckey or X button, clicking backdropFiles Changed
website/src/theme/Mermaid/index.jswebsite/src/theme/Mermaid/styles.module.csswebsite/src/css/custom.css.gu-viewer,.gu-wrap-outer,.gu-wrap-inner,.gu-toolbar,.gu-tb-btn,.gu-tb-pctwebsite/package.json@panzoom/panzoomdependency🤖 Generated with Claude Code