Skip to content

Commit

Permalink
added passed down api for functions in legendView
Browse files Browse the repository at this point in the history
  • Loading branch information
jiawulin001 committed Apr 21, 2022
1 parent ec1db26 commit 94856a9
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/component/legend/LegendView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ class LegendView extends ComponentView {
const itemGroup = this._createItem(
seriesModel, name, dataIndex,
legendItemModel, legendModel, itemAlign,
lineVisualStyle, style, legendIcon, selectMode
lineVisualStyle, style, legendIcon, selectMode, api
);

itemGroup.on('click', curry(dispatchSelectAction, name, null, api, excludeSeriesId))
Expand Down Expand Up @@ -259,7 +259,7 @@ class LegendView extends ComponentView {
const itemGroup = this._createItem(
seriesModel, name, dataIndex,
legendItemModel, legendModel, itemAlign,
{}, style, legendIcon, selectMode
{}, style, legendIcon, selectMode, api
);

// FIXME: consider different series has items with the same name.
Expand Down Expand Up @@ -340,7 +340,8 @@ class LegendView extends ComponentView {
lineVisualStyle: LineStyleProps,
itemVisualStyle: PathStyleProps,
legendIcon: string,
selectMode: LegendOption['selectedMode']
selectMode: LegendOption['selectedMode'],
api: ExtensionAPI
) {
const drawType = seriesModel.visualDrawType;
const itemWidth = legendModel.get('itemWidth');
Expand All @@ -359,7 +360,8 @@ class LegendView extends ComponentView {
lineVisualStyle,
itemVisualStyle,
drawType,
isSelected
isSelected,
api
);

const itemGroup = new Group();
Expand Down Expand Up @@ -544,7 +546,8 @@ function getLegendStyle(
lineVisualStyle: PathStyleProps,
itemVisualStyle: PathStyleProps,
drawType: 'fill' | 'stroke',
isSelected: boolean
isSelected: boolean,
api: ExtensionAPI
) {
/**
* Use series style if is inherit;
Expand All @@ -570,7 +573,7 @@ function getLegendStyle(
itemStyle.decal = itemVisualStyle.decal;
}
else {
itemStyle.decal = createOrUpdatePatternFromDecal(decalStyle, legendItemModel.ecModel.scheduler.api);
itemStyle.decal = createOrUpdatePatternFromDecal(decalStyle, api);
}

if (itemStyle.fill === 'inherit') {
Expand Down

0 comments on commit 94856a9

Please sign in to comment.