Skip to content

Commit

Permalink
fix(visual): fix legend modify alpha on transparent color
Browse files Browse the repository at this point in the history
  • Loading branch information
pissang committed Jan 7, 2022
1 parent 60c0fdf commit 72f4c41
Show file tree
Hide file tree
Showing 2 changed files with 109 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/component/legend/LegendView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ import {
SymbolOptionMixin
} from '../../util/types';
import Model from '../../model/Model';
import {LineStyleProps, LINE_STYLE_KEY_MAP} from '../../model/mixin/lineStyle';
import {ITEM_STYLE_KEY_MAP} from '../../model/mixin/itemStyle';
import {LineStyleProps} from '../../model/mixin/lineStyle';
import {createSymbol, ECSymbol} from '../../util/symbol';
import SeriesModel from '../../model/Series';

Expand Down Expand Up @@ -244,7 +243,7 @@ class LegendView extends ComponentView {

const idx = provider.indexOfName(name);

const style = provider.getItemVisual(idx, 'style') as PathStyleProps;
let style = provider.getItemVisual(idx, 'style') as PathStyleProps;
const legendIcon = provider.getItemVisual(idx, 'legendIcon');

const colorArr = parse(style.fill as ColorString);
Expand All @@ -253,7 +252,7 @@ class LegendView extends ComponentView {
if (colorArr && colorArr[3] === 0) {
colorArr[3] = 0.2;
// TODO color is set to 0, 0, 0, 0. Should show correct RGBA
style.fill = stringify(colorArr, 'rgba');
style = zrUtil.extend(zrUtil.extend({}, style), { fill: stringify(colorArr, 'rgba') });
}

const itemGroup = this._createItem(
Expand Down
106 changes: 106 additions & 0 deletions test/pie-case.html

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

0 comments on commit 72f4c41

Please sign in to comment.