fix: allow beforeTooltipDraw to be cancelable (#10598)

This commit is contained in:
Grant Hynd
2022-08-22 16:33:02 +01:00
committed by GitHub
parent eaee1ad63b
commit 75793eb86f
2 changed files with 2 additions and 2 deletions

View File

@@ -1241,7 +1241,7 @@ export default {
tooltip
};
if (chart.notifyPlugins('beforeTooltipDraw', args) === false) {
if (chart.notifyPlugins('beforeTooltipDraw', {...args, cancelable: true}) === false) {
return;
}

2
types/index.d.ts vendored
View File

@@ -2575,7 +2575,7 @@ export interface ExtendedPlugin<
* @param {object} options - The plugin options.
* @returns {boolean} `false` to cancel the chart tooltip drawing.
*/
beforeTooltipDraw?(chart: Chart, args: { tooltip: Model }, options: O): boolean | void;
beforeTooltipDraw?(chart: Chart, args: { tooltip: Model, cancelable: true }, options: O): boolean | void;
/**
* @desc Called after drawing the `tooltip`. Note that this hook will not
* be called if the tooltip drawing has been previously cancelled.