Skip to content

Make sure we show full mermaid diagram when opened in new editor#317244

Merged
mjbvz merged 1 commit into
microsoft:mainfrom
mjbvz:dev/mjbvz/horrible-emu
May 20, 2026
Merged

Make sure we show full mermaid diagram when opened in new editor#317244
mjbvz merged 1 commit into
microsoft:mainfrom
mjbvz:dev/mjbvz/horrible-emu

Conversation

@mjbvz
Copy link
Copy Markdown
Collaborator

@mjbvz mjbvz commented May 19, 2026

Fixes #317075

Copilot AI review requested due to automatic review settings May 19, 2026 05:01
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 defaultView option 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.ts while 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));
@mjbvz mjbvz merged commit 5683dbc into microsoft:main May 20, 2026
29 checks passed
@vs-code-engineering vs-code-engineering Bot added this to the 1.122.0 milestone May 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants