mirror of
https://github.com/chartjs/Chart.js.git
synced 2026-03-14 20:26:50 +01:00
Do not notify plugins when a silent resize occurs (#3650)
Prevent the resize method from notifying plugins if it is a silent resize. A silent resize occurs during startup and we do not want plugins to do anything here because the chart is not set up.
This commit is contained in:
committed by
Simon Brunel
parent
b6807b2dd9
commit
5bf203037c
@@ -312,16 +312,16 @@ module.exports = function(Chart) {
|
||||
|
||||
helpers.retinaScale(chart);
|
||||
|
||||
// Notify any plugins about the resize
|
||||
var newSize = {width: newWidth, height: newHeight};
|
||||
Chart.plugins.notify('resize', [me, newSize]);
|
||||
|
||||
// Notify of resize
|
||||
if (me.options.onResize) {
|
||||
me.options.onResize(me, newSize);
|
||||
}
|
||||
|
||||
if (!silent) {
|
||||
// Notify any plugins about the resize
|
||||
var newSize = {width: newWidth, height: newHeight};
|
||||
Chart.plugins.notify('resize', [me, newSize]);
|
||||
|
||||
// Notify of resize
|
||||
if (me.options.onResize) {
|
||||
me.options.onResize(me, newSize);
|
||||
}
|
||||
|
||||
me.stop();
|
||||
me.update(me.options.responsiveAnimationDuration);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user