-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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: update zIndex while calling setParent & deduplicate while translating. #6295
Conversation
HawtinZeng
commented
Sep 7, 2024
- fix(DataController): after calling graph.addChildrenData(nodeInCombo, [nodeNotInCombo]), can not listen click event of added node.
- fix(DataController): translateComboBy will make twice tranlations to the same child node of a combo
Hi, antv teams, there are two flaws I have found, watch the gif below:
|
Thanks for your contribution, we will confirm and validate this pull request soon. |
packages/g6/src/runtime/data.ts
Outdated
eleData.style = {}; | ||
} | ||
if (this.isCombo(parent)) { | ||
eleData.style.zIndex = parentData.style!.zIndex + 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's better to add an alternative value when parentData.style.zIndex is undefined, and you can use set and get function which exported from @antv/util
to simplify the code,
like:
const zIndex = get(parentData, ['style', 'zIndex'], 0) + this.isCombo(parent) ? 1 : 0;
set(elementData, ['style', 'zIndex'], zIndex);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Glad to receive your review. We shuldn't change the original action about zIndex, because many(10+ test suits) depend on the original zIndex version. Besides, thanks for your concise code suggestion, we should wrap the ternary with ()
.
It seems that the test snapshots should be updated, you can re-generate related snapshots as follows:
rm -rf packages/g6/__tests__/snapshots/behaviors/drag-element-combo
rm -rf packages/g6/__tests__/snapshots/behaviors/collapse-expand-node
rm -rf packages/g6/__tests__/snapshots/plugins/history/plugin-history
cd ./packages/g6
npm run test
|
0a83370
to
36b9d63
Compare
All tests passed, maybe the test suit should be less strict. |
By the way, these svg changes are messy : ( |
Generally speaking, a version of the modification will not cause such a huge change in the screenshots. I can't even view the changes on GitHub. I switched to your branch to view yesterday. In fact, only a dozen screenshots need to be updated. |
@HawtinZeng The screenshots you updated are located in |
Hi @HawtinZeng , I believe this bug fix is important and should be merged as soon as possible. Here's the pull request: #6320. You can refer to this PR for modifications. If you don’t have time to review it soon, we will close this PR and merge an alternative one. |
I will commit some changes tonight.
…---Original---
From: ***@***.***>
Date: Wed, Sep 11, 2024 17:02 PM
To: ***@***.***>;
Cc: "Hawtin ***@***.******@***.***>;
Subject: Re: [antvis/G6] fix: update zIndex while calling setParent &deduplicate while translating. (PR #6295)
Hi @HawtinZeng , I believe this bug fix is important and should be merged as soon as possible. Here's the pull request: #6320. You can refer to this PR for modifications. If you don’t have time to review it soon, we will close this PR and merge an alternative one.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Hi, Aaron, I have tried many ways to pass jest, but failed finally, there are 3 units tests haven't pass, I can pass these tests with running a single test, but can't pass the test when running all tests, maybe some contexts have interference to these failed tests. |
@HawtinZeng You can refer to the methods I mentioned earlier. Normal operations should not lead to the problems you encountered. Be sure to note that when you execute the A simple test review:
|
The pull request: #6320 is a standard submit, and your modification scope should not exceed it. (Ignore the coverage) |
OK
…---Original---
From: ***@***.***>
Date: Thu, Sep 12, 2024 10:48 AM
To: ***@***.***>;
Cc: "Hawtin ***@***.******@***.***>;
Subject: Re: [antvis/G6] fix: update zIndex while calling setParent &deduplicate while translating. (PR #6295)
The pull request: #6320 is a standard submit, and your modification scope should not exceed it.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the original test suit is wrong, so I change the zIndex of node-1 to avoid subsequent test errors.
packages/g6/__tests__/utils/dir.ts
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In Windows, the cwd path is: 'xxx\\xxx\\xxx.xxx', we need path.sep to fix this.
@HawtinZeng The latest commit looks much better, thanks for your efforts, and the final thing is to remove the files under |
* fix: deduplicate multiple translations to the same node * test: update zIndex related snapshots * fix: deal with path seperator in Windows
Hi, Aarebecca, finished this PR finally. |
* fix: change zIndex in DataController (#6295) * fix: deduplicate multiple translations to the same node * test: update zIndex related snapshots * fix: deal with path seperator in Windows * test: update test snapshots --------- Co-authored-by: Hawtin Zeng <73981739+HawtinZeng@users.noreply.github.com> Co-authored-by: antv <antv@antfin.com>