Skip to content

Commit

Permalink
Merge pull request #18260 from ChepteaCatalin/fix-18196
Browse files Browse the repository at this point in the history
fix(legend): inherit legend rich text color from legend's options
  • Loading branch information
Ovilia authored Apr 3, 2023
2 parents cb5b976 + c621972 commit f5bb3b0
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/component/legend/LegendView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -413,16 +413,18 @@ class LegendView extends ComponentView {
content = formatter(name);
}

const inactiveColor = legendItemModel.get('inactiveColor');
const textColor = isSelected
? textStyleModel.getTextColor() : legendItemModel.get('inactiveColor');

itemGroup.add(new graphic.Text({
style: createTextStyle(textStyleModel, {
text: content,
x: textX,
y: itemHeight / 2,
fill: isSelected ? textStyleModel.getTextColor() : inactiveColor,
fill: textColor,
align: textAlign,
verticalAlign: 'middle'
})
}, {inheritColor: textColor})
}));

// Add a invisible rect to increase the area of mouse hover
Expand Down
56 changes: 56 additions & 0 deletions test/legend-style.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f5bb3b0

Please sign in to comment.