From: Evert Timberg Date: Tue, 29 Nov 2016 09:43:52 +0000 (-0500) Subject: Do not notify plugins when a silent resize occurs (#3650) X-Git-Tag: v2.5.0~1^2~37 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5bf203037c667b5450093a1cd8164cef1461698e;p=thirdparty%2FChart.js.git 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. --- diff --git a/src/core/core.controller.js b/src/core/core.controller.js index ebbd081af..1abc81075 100644 --- a/src/core/core.controller.js +++ b/src/core/core.controller.js @@ -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]); + 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); - } + // Notify of resize + if (me.options.onResize) { + me.options.onResize(me, newSize); + } - if (!silent) { me.stop(); me.update(me.options.responsiveAnimationDuration); }