Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use transform instead of x/y #315

Merged
merged 13 commits into from
Mar 21, 2024
Merged

fix: use transform instead of x/y #315

merged 13 commits into from
Mar 21, 2024

Conversation

xiaoiver
Copy link
Contributor

@xiaoiver xiaoiver commented Jan 23, 2024

https://www.yuque.com/antv/ou292n/fv4rqhytfb9yu5fu

使用 transform 代替 Group / CustomElement 上的 x/y 属性。

// before
group.style.x = 100;
group.style.y = 100;

// after
group.style.transform = 'translate(100, 100)';

并修复之前 component 中存在的一些 transform 相关 bug。

@xiaoiver xiaoiver changed the title fix: use transform instead of x/y [WIP] fix: use transform instead of x/y Jan 23, 2024
@Aarebecca
Copy link
Contributor

这个需要开关打开吗,还是说升级到指定 G 版本就默认使用该特性。

@xiaoiver
Copy link
Contributor Author

xiaoiver commented Feb 2, 2024

从生成的 SVG 也能看出,未设置 transform & transformOrigin 的图形不会计算 transform:

// before
<g transform="matrix(1,0,0,1,150,500)">
  <path
    id="g-svg-111"
    d="M 0,0 L 40,0"
  />
</g>

// after
<g>
  <path
    id="g-svg-111"
    d="M 150,500 L 190,500"
  />
</g>

@xiaoiver xiaoiver changed the title [WIP] fix: use transform instead of x/y fix: use transform instead of x/y Feb 4, 2024
@xiaoiver
Copy link
Contributor Author

@xiaoiver xiaoiver merged commit 505dae5 into master Mar 21, 2024
2 checks passed
@xiaoiver xiaoiver deleted the fix-transform branch March 21, 2024 11:58
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.

2 participants