mirror of
https://github.com/chartjs/Chart.js.git
synced 2024-10-06 12:19:08 +02:00
Tooltip: Render when animations are disabled (#8252)
This commit is contained in:
parent
6ffc380c6a
commit
d00ffdcd76
@ -504,3 +504,4 @@ All helpers are now exposed in a flat hierarchy, e.g., `Chart.helpers.canvas.cli
|
||||
* `afterEvent` and `beforeEvent` now receive a wrapped `event` as the `event` property of the second argument. The native event is available via `args.event.native`.
|
||||
* Initial `resize` is no longer silent. Meaning that `resize` event can fire between `beforeInit` and `afterInit`
|
||||
* New hooks: `install`, `start`, `stop`, and `uninstall`
|
||||
* `afterEvent` should notify about changes that need a render by setting `args.changed` to true. Because the `args` are shared with all plugins, it should only be set to true and not false.
|
||||
|
@ -1035,7 +1035,7 @@ class Chart {
|
||||
args.cancellable = false;
|
||||
me.notifyPlugins('afterEvent', args);
|
||||
|
||||
if (changed) {
|
||||
if (changed || args.changed) {
|
||||
me.render();
|
||||
}
|
||||
|
||||
|
@ -1089,7 +1089,10 @@ export default {
|
||||
if (chart.tooltip) {
|
||||
// If the event is replayed from `update`, we should evaluate with the final positions.
|
||||
const useFinalPosition = args.replay;
|
||||
chart.tooltip.handleEvent(args.event, useFinalPosition);
|
||||
if (chart.tooltip.handleEvent(args.event, useFinalPosition)) {
|
||||
// notify chart about the change, so it will render
|
||||
args.changed = true;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
5
types/index.esm.d.ts
vendored
5
types/index.esm.d.ts
vendored
@ -975,10 +975,11 @@ export interface Plugin<O = {}> extends ExtendedPlugin {
|
||||
* @param {Chart} chart - The chart instance.
|
||||
* @param {object} args - The call arguments.
|
||||
* @param {ChartEvent} args.event - The event object.
|
||||
* @param {boolean} replay - True if this event is replayed from `Chart.update`
|
||||
* @param {boolean} args.replay - True if this event is replayed from `Chart.update`
|
||||
* @param {boolean} [args.changed] - Set to true if the plugin needs a render. Should only be changed to true, because this args object is passed through all plugins.
|
||||
* @param {object} options - The plugin options.
|
||||
*/
|
||||
afterEvent?(chart: Chart, args: { event: ChartEvent, replay: boolean }, options: O): void;
|
||||
afterEvent?(chart: Chart, args: { event: ChartEvent, replay: boolean, changed?: boolean }, options: O): void;
|
||||
/**
|
||||
* @desc Called after the chart as been resized.
|
||||
* @param {Chart} chart - The chart instance.
|
||||
|
Loading…
Reference in New Issue
Block a user