Initialize SVG viewBox to prevent zoom control jump on first interaction#1026
Merged
sei-vsarvepalli merged 2 commits intomainfrom Oct 28, 2025
Merged
Initialize SVG viewBox to prevent zoom control jump on first interaction#1026sei-vsarvepalli merged 2 commits intomainfrom
sei-vsarvepalli merged 2 commits intomainfrom
Conversation
Set viewBox attribute when SVG is created to match initial dimensions (100% zoom). This prevents unexpected visual changes on first zoom control interaction. Fixes issue where graph would jump/resize on first click of zoom slider even at 100%. Co-authored-by: sei-vsarvepalli <19911912+sei-vsarvepalli@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix zoom control activation in graph view module
Initialize SVG viewBox to prevent zoom control jump on first interaction
Oct 28, 2025
sei-vsarvepalli
approved these changes
Oct 28, 2025
Contributor
sei-vsarvepalli
left a comment
There was a problem hiding this comment.
Copilot you worked hard to get this one line done! You are hard worker.
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds a viewBox attribute to an SVG element to improve its scalability and responsive behavior. The viewBox attribute enables the SVG to scale proportionally when its container dimensions change.
Key Changes
- Added
viewBoxattribute to the SVG element with coordinates matching the width and height dimensions
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
The zoom control caused the graph to unexpectedly resize on first click at 100% because the SVG's
viewBoxattribute was uninitialized until user interaction.Changes
viewBoxinitialization indocs/ssvc-explorer/simple.jsline 134 when creating the SVG elementBefore:
After:
The viewBox now matches the dimensions at 100% zoom (
zf=1.0), consistent with the zoom control's calculation on line 124.Demonstration
Before fix: First click at 100% zoom causes content to jump/resize

After fix: Content remains stable at initial 100% zoom

Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.