Make sure we show full mermaid diagram when opened in new editor#317244
Open
mjbvz wants to merge 1 commit into
Open
Make sure we show full mermaid diagram when opened in new editor#317244mjbvz wants to merge 1 commit into
mjbvz wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the Mermaid chat/editor webview pan-zoom behavior so diagrams opened in the dedicated editor can default to a fitted view instead of being centered at 100% scale.
Changes:
- Adds a
defaultViewoption to the Mermaid webview pan/zoom initialization. - Implements fit-to-container sizing and padding for editor-opened Mermaid diagrams.
- Uses the fit default from
index-editor.tswhile keeping the chat output default centered.
Show a summary per file
| File | Description |
|---|---|
extensions/mermaid-markdown-features/preview-src/chat/mermaidWebview.ts |
Adds fit-view sizing logic and passes options into PanZoomHandler. |
extensions/mermaid-markdown-features/preview-src/chat/index-editor.ts |
Initializes the editor webview with defaultView: 'fit'. |
Copilot's findings
- Files reviewed: 2/2 changed files
- Comments generated: 1
Comment on lines
+369
to
+370
| const minAllowedScale = Math.min(this.minScale, this.fitScale, this.scale); | ||
| const newScale = Math.min(this.maxScale, Math.max(minAllowedScale, this.scale * factor)); |
aeschli
approved these changes
May 19, 2026
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.
Fixes #317075