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: remove defXY and cx/cy should not affect transform #1624 #1627

Merged
merged 24 commits into from
Mar 21, 2024

Conversation

xiaoiver
Copy link
Contributor

@xiaoiver xiaoiver commented Jan 16, 2024

🤔 This is a ...

  • New feature
  • Bug fix
  • Site / Document optimization
  • TypeScript definition update
  • Refactoring
  • Performance improvement
  • Code style optimization
  • Test Case
  • Branch merge
  • Other (about what?)

🔗 Related issue link

#1624

💡 Background and solution

目前以下属性均会影响 transform,不光会增加初始化阶段的时间影响性能,也会让 transformOrigin 这样的属性变得晦涩。

  • Circle / Ellipse 的 cx/cy
  • Rect / Group / CustomElement 的 x/y
  • Line 的 x1/y1/x2/y2
  • Path 的 d

GUI / G2 中由该问题引发了不少问题:

  • SVG 动画闪动
  • component 中需要反复设置 transform,重新计算包围盒等

因此在 group & customElement 去除 x/y 属性,同时去除 anchor 属性。
值得一提的是在 SVG 规范中 也是没有 x/y 属性的:https://developer.mozilla.org/en-US/docs/Web/SVG/Element/g

📝 Changelog

Language Changelog
🇺🇸 English
🇨🇳 Chinese

☑️ Self Check before Merge

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • TypeScript definition is updated/provided or not needed
  • Changelog is provided or not needed

Copy link

@accesslint accesslint bot left a comment

Choose a reason for hiding this comment

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

There are accessibility issues in these changes.

/**
* <pattern>
* support the following image source:
* * HTMLImageElement (<img>)
Copy link

Choose a reason for hiding this comment

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

This image is missing a text alternative. This is a problem for people using screen readers.

export async function pattern({ canvas }) {
await canvas.ready;

// <img> URL
Copy link

Choose a reason for hiding this comment

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

This image is missing a text alternative. This is a problem for people using screen readers.

canvas.appendChild(rect4);

{
// HTMLImageElement(<img>)
Copy link

Choose a reason for hiding this comment

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

This image is missing a text alternative. This is a problem for people using screen readers.

Base automatically changed from release to next February 23, 2024 05:36
Copy link

@github-advanced-security github-advanced-security bot left a comment

Choose a reason for hiding this comment

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

CodeQL found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

@xiaoiver xiaoiver changed the base branch from next to release March 21, 2024 06:39
@xiaoiver xiaoiver merged commit 424711b into release Mar 21, 2024
3 checks passed
@xiaoiver xiaoiver deleted the fix-1624 branch March 21, 2024 08:11
xiaoiver added a commit that referenced this pull request Mar 21, 2024
* fix: remove defXY and cx/cy should not affect transform #1624 (#1627)

* fix: remove defXY and cx/cy should not affect transform #1624

* fix: patterns

* fix: remove anchor

* fix: annotation plugin

* chore: commit changeset

* fix: x/y in rect can be omitted

* chore: commit changeset

* chore: version

* chore: version

* chore: bump version

* fix: insert event will trigger by default

* chore: commit changeset

* fix: lazy update geometry

* fix: lazy calculate geometry

* chore: bump version

* fix: refactor parse transform

* fix: transform origin

* chore: bump

* chore: stash

* chore: bump test version

* chore: fix testcases

* chore: update snapshots

* chore: commit changeset

* chore: commit changeset (#1646)

* chore(release): bump version (#1645)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
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.

1 participant