Skip to content

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

Open
mjbvz wants to merge 1 commit into
microsoft:mainfrom
mjbvz:dev/mjbvz/horrible-emu
Open

Make sure we show full mermaid diagram when opened in new editor#317244
mjbvz wants to merge 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));
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.

Mermaid: hit the "expand" button (far right) and the diagram was cut off

3 participants