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(pie): hide labelLine emphasis when inside #14702

Merged
merged 2 commits into from
Apr 20, 2021

Conversation

villebro
Copy link
Member

@villebro villebro commented Apr 18, 2021

Brief Information

This pull request is in the type of:

  • bug fixing
  • new feature
  • others

What does this PR do?

Currently the label line will stay visible on emphasis when changing from outside to inside. This PR fixes this problem and adds a test to show that emphasis works even after changing back and forth.

Details

Before: What was the problem?

pie-before

After: How is it fixed in this PR?

pie-after

Merging options

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

Other information

@echarts-bot
Copy link

echarts-bot bot commented Apr 18, 2021

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.

The pull request is marked to be PR: author is committer because you are a committer of this project.

@susiwen8
Copy link
Contributor

LGTM, @pissang could you double check?

susiwen8
susiwen8 previously approved these changes Apr 19, 2021
@susiwen8 susiwen8 requested a review from pissang April 19, 2021 07:21
@@ -193,7 +193,7 @@ class PiePiece extends graphic.Sector {

const labelPosition = seriesModel.get(['label', 'position']);
if (labelPosition !== 'outside' && labelPosition !== 'outer') {
sector.getTextGuideLine()?.hide();
sector.removeTextGuideLine();
return;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems the guideline can't be restored if the position is changed from 'inside' to 'outside' again. Perhaps we need to recreate the guideline here instead of in

this.setTextGuideLine(polyline);

if (..)  { ... }
else {
  let polyline = this.getTextGuideLine();
  if (!polyline) {
    polyline = new graphic.Polyline();
    this.setTextGuideLine(polyline);
  }
  // Default use item visual color
   setLabelLineStyle(this, getLabelLineStatesModels(itemModel), {
       stroke: visualColor,
       opacity: retrieve3(labelLineModel.get(['lineStyle', 'opacity']), visualOpacity, 1)
    });
}

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for the review @pissang ! This change makes sense, and I did the proposed changes. I also added yet another flip-flop (inside/outside) to the test to make sure it can change back yet one more time, just in case.

Copy link
Member Author

Choose a reason for hiding this comment

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

The relevant updated test:
pie-after2

@pissang pissang merged commit e96cf6f into apache:master Apr 20, 2021
@echarts-bot
Copy link

echarts-bot bot commented Apr 20, 2021

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

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.

None yet

3 participants