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: markArea display filter correction #16861

Merged
merged 11 commits into from
Apr 15, 2022
Merged

Conversation

jiawulin001
Copy link
Member

@jiawulin001 jiawulin001 commented Apr 11, 2022

Brief Information

This pull request is in the type of:

  • bug fixing
  • new feature
  • others

What does this PR do?

Correct the markArea filter when both diagonal points are not in coordinate system.

Fixed issues

Details

Before: What was the problem?

MarkArea will disappear if both anchor points of it are not in the coordinate system.

before#16853

After: How is it fixed in this PR?

MarkArea is correctly displayed.

after#16853

Misc

  • The API has been changed (apache/echarts-doc#xxx).
  • This PR depends on ZRender changes (ecomfe/zrender#xxx).

Related test cases or examples to use the new APIs

Attached

@echarts-bot
Copy link

echarts-bot bot commented Apr 11, 2022

Thanks for your contribution!
The community will review it ASAP. In the meanwhile, please checkout the coding standard and Wiki about How to make a pull request.

src/coord/cartesian/Cartesian2D.ts Outdated Show resolved Hide resolved
@@ -123,6 +123,20 @@ function markAreaFilter(coordSys: CoordinateSystem, item: MarkAreaMergedItemOpti
) {
return true;
}
/*Another zone filter is applied, which might not be necessary.
Directly returning true means displaying markArea component permanently,
Copy link
Contributor

Choose a reason for hiding this comment

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

We prefer using inline comment // here.

Also this comment seems to be outdated after new commits?

Copy link
Member Author

Choose a reason for hiding this comment

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

For this one, I mean we are using a function zonefilter here, but actually returning true can achieve almost the same effect as using this function. The reason is that, when returning true, markArea is always shown and will not be clipped however the grid changes, which solves the problem. When the coordinates does not include the markArea, it's automatically not shown. So in my opinion a function to check if the coordinates intersect with markArea is unnecessary. Of course, keeping the markArea rendered may be problematic when there are huge amount of them, but in most cases one or two markAreas would hardly affect performance.

Copy link
Contributor

@pissang pissang Apr 14, 2022

Choose a reason for hiding this comment

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

Got it. Thanks for the detailed explanation. Perhaps we can tweak the description a bit to make it more clear. For example:

Directly returning true may also do the work. But filtering ahead will avoid creating too much unnecessary elements when there are huge amount of elements.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point. Comment updated.

@pissang
Copy link
Contributor

pissang commented Apr 14, 2022

Added recorded user interaction for visual regression testing

pissang
pissang previously approved these changes Apr 15, 2022
@pissang pissang merged commit a5257e3 into apache:master Apr 15, 2022
@echarts-bot
Copy link

echarts-bot bot commented Apr 15, 2022

Congratulations! Your PR has been merged. Thanks for your contribution! 👍

@pissang pissang added this to the 5.3.3 milestone Apr 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] markAreas disappear when zooming in
2 participants