antvis / antvis/G6

[Bug]: V5版本设置rotation后 缩放中心定位不正常

Open
#7,578 1 comment 0 reactions 0 assignees View on GitHub
bug 🐛
Dominant language
TypeScript
Stars
12.3k
Forks
1.6k
PR merge metrics
No merged PRs in 30d

Description

### Describe the bug / 问题描述

new Graph({
// renderer: () => new SVGRenderer(),
container: context.container,
animation: true,
background: "transparent",
padding: 20,
rotation: isLandscape ? 90 : 0,
autoFit: {
type: 'view',
options: {
// 仅适用于 'view' 类型
when: 'always', // 何时适配:'overflow'(仅当内容溢出时) 或 'always'(总是适配)
direction: 'both', // 适配方向:'x'、'y' 或 'both'
},
},
zoomRange: [0.2, 1],
behaviors: [
{
type: 'drag-canvas',
enable: true,
key: 'drag-behavior',
},
...context.getZoomBehaviors(),
],
});
设置rotation后 ,图形进行了旋转但是 autoFit失效,显示靠边。且缩放时,缩放中心定位不正确,导致显示不对。

### Reproduction link / 复现链接

_No response_

### Steps to Reproduce the Bug or Issue / 重现步骤

rotation: 90,

### Version / 版本

🆕 5.x

### OS / 操作系统

- [ ] macOS
- [x] Windows
- [ ] Linux
- [ ] Others / 其他

### Browser / 浏览器

- [x] Chrome
- [ ] Edge
- [ ] Firefox
- [ ] Safari (Limited support / 有限支持)
- [ ] IE (Nonsupport / 不支持)
- [ ] Others / 其他

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the Graph configuration shown with rotation set to 90, autoFit enabled, and zoom behaviors active. Trace the rotation, autoFit, and zoom-center handling from the Graph entry point; done means the rotated graph fits correctly and zooming remains centered on the intended location.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
data-visualization
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.