From: Jukka Kurkela Date: Tue, 29 Dec 2020 15:10:32 +0000 (+0200) Subject: Skip reset when animations are disabled (#8248) X-Git-Tag: v3.0.0-beta.8~21 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c2091fc77dd70435e339e6167b1556891a7da451;p=thirdparty%2FChart.js.git Skip reset when animations are disabled (#8248) * Skip reset when animations are disabled * Review update --- diff --git a/src/core/core.controller.js b/src/core/core.controller.js index 6b9f95e31..54ddd2f8d 100644 --- a/src/core/core.controller.js +++ b/src/core/core.controller.js @@ -453,7 +453,7 @@ class Chart { me.config.update(me.options); me.options = me.config.options; - me._animationsDisabled = !me.options.animation; + const animsDisabled = me._animationsDisabled = !me.options.animation; me.ensureScalesHaveIDs(); me.buildOrUpdateScales(); @@ -476,10 +476,14 @@ class Chart { me._updateLayout(); - // Can only reset the new controllers after the scales have been updated - each(newControllers, (controller) => { - controller.reset(); - }); + // Only reset the controllers if we have animations + if (!animsDisabled) { + // Can only reset the new controllers after the scales have been updated + // Reset is done to get the starting point for the initial animation + each(newControllers, (controller) => { + controller.reset(); + }); + } me._updateDatasets(mode); diff --git a/src/core/core.datasetController.js b/src/core/core.datasetController.js index 4dbc92956..beb973a74 100644 --- a/src/core/core.datasetController.js +++ b/src/core/core.datasetController.js @@ -901,7 +901,7 @@ export default class DatasetController { * @protected */ includeOptions(mode, sharedOptions) { - return !sharedOptions || isDirectUpdateMode(mode); + return !sharedOptions || isDirectUpdateMode(mode) || this.chart._animationsDisabled; } /**