Skip to content

Commit

Permalink
feat: support highlight inverse select
Browse files Browse the repository at this point in the history
  • Loading branch information
neuqzxy committed Dec 25, 2024
1 parent 00fe014 commit e637041
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/vstory-player/src/processor/chart/highlight.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class VChartHighlightActionProcessor extends VChartBaseActionProcessor {
}

const { payload } = actionSpec as IChartHighlightAction;
const { value, animation, style = {} } = payload as IChartHighlightPayload;
const { value, inverse, animation, style = {} } = payload as IChartHighlightPayload;
const isDatumEqual = (inputValue: any, elementDatum: any) =>
Object.keys(inputValue).every(key => inputValue[key] === elementDatum[key]);
const channel = {};
Expand All @@ -42,7 +42,7 @@ export class VChartHighlightActionProcessor extends VChartBaseActionProcessor {
},
duration: animation?.duration ?? 0
},
partitioner: datum => isDatumEqual(value, datum)
partitioner: datum => (inverse ? !isDatumEqual(value, datum) : isDatumEqual(value, datum))
});
}
});
Expand Down
1 change: 1 addition & 0 deletions packages/vstory-player/src/processor/chart/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export interface IChartUpdateAction extends IAction<IChartUpdatePayload> {
/************ Highlight **************/
export interface IChartHighlightPayload extends IActionPayload {
value: Datum;
inverse?: boolean;
id: string | number;
style: {
[key: string]: number | string;
Expand Down

0 comments on commit e637041

Please sign in to comment.