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:
Evert Timberg
2016-11-29 04:43:52 -05:00
committed by Simon Brunel
parent b6807b2dd9
commit 5bf203037c

View File

@@ -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);
}