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(state): fix focus self not work when item emphasis by other component #18511

Merged
merged 2 commits into from
Apr 25, 2023

Conversation

linghaoSu
Copy link
Member

@linghaoSu linghaoSu commented Apr 13, 2023

Brief Information

This pull request is in the type of:

  • bug fixing
  • new feature
  • others

What does this PR do?

fix focus: 'self' not work when item emphasis by other component

Fixed issues

Fix #18475

Details

Before: What was the problem?

When axisPointer is set to axis or line, the elements in the chart will be triggered to be highlighted and the __highByOuter property on the elements will be marked to indicate that they are currently highlighted,

image

but when emphasis.focus = 'self' is also set, it will enter blurSeries logic, where all the elements in the chart will be forced to blur
image

and then go to enterEmphasisWhenMouseOver, where the element with focus:'self' will be highlighted

image

But since the element has already been highlighted by axisPointer, __highByOuter is no longer the value of falsy, and in this method it determines whether this property is falsy, and if so, it goes to the highlighting of the node.

Obviously, in this case, the node that should have been highlighted is first blurred, and then the highlighting logic is skipped

After: How does it behave after the fixing?

I'm not quite sure why I'm adding the node __highByOuter to be falsy here as a basis for continuing to highlight or not

So in the blurSeries method, if a series is focus self and is a highlighted trigger series, if there are elements in the series that have been marked __highByOuter by another z component, then that element will be skipped blur

image

Document Info

One of the following should be checked.

  • This PR doesn't relate to document changes
  • The document should be updated later
  • The document changes have been made in apache/echarts-doc#xxx

Misc

ZRender Changes

  • This PR depends on ZRender changes (ecomfe/zrender#xxx).

Related test cases or examples to use the new APIs

test/emphasis-self.html to test focus: 'self' when axisPointer = 'axis'

Others

Merging options

  • Please squash the commits into a single one when merging.

Other information

@echarts-bot
Copy link

echarts-bot bot commented Apr 13, 2023

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.

Copy link
Contributor

@Ovilia Ovilia left a comment

Choose a reason for hiding this comment

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

Looks good to me. Tested and passed with visual test cases.

src/util/states.ts Outdated Show resolved Hide resolved
@Ovilia Ovilia merged commit 6da8276 into apache:master Apr 25, 2023
@echarts-bot
Copy link

echarts-bot bot commented Apr 25, 2023

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

@Ovilia Ovilia added this to the 5.5.0 milestone Apr 25, 2023
@linghaoSu linghaoSu deleted the fix/emphasis_self branch April 25, 2023 07:57
@plainheart plainheart modified the milestones: 5.5.0, 5.4.3 Jun 25, 2023
@plainheart plainheart changed the title fix(emphasis): fix focus self not work when item emphasis by other component fix(state): fix focus self not work when item emphasis by other component Jul 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] tooltip.trigger='axis'时,emphasis的focus失效,并且将会blur所有元素
3 participants