Skip reset when animations are disabled (#8248)

* Skip reset when animations are disabled
* Review update
This commit is contained in:
Jukka Kurkela 2020-12-29 17:10:32 +02:00 committed by GitHub
parent 12682c619d
commit c2091fc77d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 6 deletions

View File

@ -453,7 +453,7 @@ class Chart {
me.config.update(me.options); me.config.update(me.options);
me.options = me.config.options; me.options = me.config.options;
me._animationsDisabled = !me.options.animation; const animsDisabled = me._animationsDisabled = !me.options.animation;
me.ensureScalesHaveIDs(); me.ensureScalesHaveIDs();
me.buildOrUpdateScales(); me.buildOrUpdateScales();
@ -476,10 +476,14 @@ class Chart {
me._updateLayout(); me._updateLayout();
// Can only reset the new controllers after the scales have been updated // Only reset the controllers if we have animations
each(newControllers, (controller) => { if (!animsDisabled) {
controller.reset(); // 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); me._updateDatasets(mode);

View File

@ -901,7 +901,7 @@ export default class DatasetController {
* @protected * @protected
*/ */
includeOptions(mode, sharedOptions) { includeOptions(mode, sharedOptions) {
return !sharedOptions || isDirectUpdateMode(mode); return !sharedOptions || isDirectUpdateMode(mode) || this.chart._animationsDisabled;
} }
/** /**