Skip to content

fix(editor): increase max viewbox size limit for large diagrams - #202

Merged
Aarebecca merged 3 commits into
antvis:mainfrom
xxMudCloudxx:fix/increase-zoom-viewbox-limit
Feb 10, 2026
Merged

Aarebecca merged 3 commits into
antvis:mainfrom
xxMudCloudxx:fix/increase-zoom-viewbox-limit

Conversation

@xxMudCloudxx

Copy link
Copy Markdown
Contributor

背景 (Background)

当渲染内容较多(例如复杂的时序交互图)时,SVG 的 viewBox 宽度往往会超过原有的硬编码限制 (2000)。这导致 zoom-wheel 交互逻辑误判当前视图已达到最大缩放边界,从而阻止用户的滚轮缩放操作,使得在大图模式下无法正常缩放查看细节。

改动详情 (Changes)

  • src/editor/interactions/zoom-wheel.ts:
    • 将 MAX_VIEWBOX_SIZE 常量从 2000 增大至 20000。
    • 这一修改极大地扩展了允许的视图尺寸范围,确保在渲染大量元素时,ViewBox 尺寸检查不会错误拦截合法的缩放请求。
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @xxMudCloudxx, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

此拉取请求解决了当渲染内容较多(例如复杂的时序交互图)时,用户无法正常缩放查看细节的问题。通过扩展 SVG viewBox 的最大尺寸限制,确保了缩放滚轮交互逻辑不会错误地阻止用户操作,从而改善了大型图表的可用性。

Highlights

  • 修复编辑器中大图的缩放问题: 提高了 MAX_VIEWBOX_SIZE 常量的值,以支持渲染大型图表,避免滚轮缩放操作被错误拦截。
Changelog
  • src/editor/interactions/zoom-wheel.ts
    • 将 MAX_VIEWBOX_SIZE 常量从 2000 增加到 20000。
Activity
  • 由 xxMudCloudxx 创建。
  • 拉取请求描述提供了背景信息和详细的改动说明。
  • 修改了文件 src/editor/interactions/zoom-wheel.ts。
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

本次改动将 MAX_VIEWBOX_SIZE 从 2000 增加到 20000,以支持更大大尺寸图表的缩放,解决了在复杂图表中无法正常缩放的问题。这是一个直接有效的修复。

然而,此项改动会影响到相关的单元测试。__tests__/unit/editor/interactions/zoom-wheel.test.ts 中的测试用例 'prevents zoom out when viewBox would exceed MAX_VIEWBOX_SIZE' 仍然依赖于旧的 2000 这个硬编码限制。为了确保代码质量和未来的可维护性,请务必更新此测试用例,使其与新的 20000 限制保持一致。

此外,我提供了一个关于将 MAX_VIEWBOX_SIZE 作为可配置项的建议,以提高组件的灵活性,您可以酌情考虑。

Comment thread src/editor/interactions/zoom-wheel.ts Resolved
@codecov-commenter

codecov-commenter commented Feb 9, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 45.94%. Comparing base (11bfa9a) to head (af19880).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #202      +/-   ##
==========================================
+ Coverage   45.92%   45.94%   +0.01%     
==========================================
  Files         338      338              
  Lines       27000    27009       +9     
  Branches     2189     2191       +2     
==========================================
+ Hits        12400    12409       +9     
  Misses      14590    14590              
  Partials       10       10              
Flag Coverage Δ
infographic 45.94% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/editor/interactions/zoom-wheel.ts 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
@xxMudCloudxx
xxMudCloudxx force-pushed the fix/increase-zoom-viewbox-limit branch from 8c14803 to af19880 Compare February 9, 2026 14:17
@xxMudCloudxx

Copy link
Copy Markdown
Contributor Author

CR后的改动详情 (Changes)

核心逻辑重构

文件: src/editor/interactions/zoom-wheel.ts

  • 接口定义:新增 ZoomWheelOptions 接口,支持通过配置项灵活设置 minViewBoxSize 和 maxViewBoxSize。
  • 配置化支持:
    • 移除了硬编码的常量,改为通过构造函数动态接收配置。

文档更新

路径: site/src/content/learn/

  • 多语言支持:同步更新了中英文文档 (editor.md & editor.en.md)。
  • 参数说明:详细说明了滚轮缩放的配置项及单位含义(明确单位为 SVG 用户单位),帮助开发者更好理解缩放基准。
@Aarebecca
Aarebecca merged commit d03fde1 into antvis:main Feb 10, 2026
1 check passed
@xxMudCloudxx
xxMudCloudxx deleted the fix/increase-zoom-viewbox-limit branch February 10, 2026 10:46
@xxMudCloudxx
xxMudCloudxx restored the fix/increase-zoom-viewbox-limit branch February 10, 2026 10:46
@xxMudCloudxx
xxMudCloudxx deleted the fix/increase-zoom-viewbox-limit branch February 10, 2026 10:46
@hustcc

hustcc commented Feb 24, 2026

Copy link
Copy Markdown
Member

@xxMudCloudxx 加个 vx,我主页介绍中有我的微信号。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

4 participants