From: Simon Brunel Date: Sun, 22 Jan 2017 20:01:46 +0000 (+0100) Subject: Make `beforeDraw` cancellable and fix easing value X-Git-Tag: v2.5.0~1^2~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1e9224d49c66507d9c7e8b745416a446a08401e2;p=thirdparty%2FChart.js.git Make `beforeDraw` cancellable and fix easing value --- diff --git a/src/core/core.controller.js b/src/core/core.controller.js index e6c196593..f67b29ff9 100644 --- a/src/core/core.controller.js +++ b/src/core/core.controller.js @@ -433,12 +433,18 @@ module.exports = function(Chart) { return me; }, - draw: function(ease) { + draw: function(easingValue) { var me = this; - var easingDecimal = ease || 1; + me.clear(); - plugins.notify(me, 'beforeDraw', [easingDecimal]); + if (easingValue === undefined || easingValue === null) { + easingValue = 1; + } + + if (plugins.notify(me, 'beforeDraw', [easingValue]) === false) { + return; + } // Draw all the scales helpers.each(me.boxes, function(box) { @@ -449,12 +455,12 @@ module.exports = function(Chart) { me.scale.draw(); } - me.drawDatasets(easingDecimal); + me.drawDatasets(easingValue); // Finally draw the tooltip - me.tooltip.transition(easingDecimal).draw(); + me.tooltip.transition(easingValue).draw(); - plugins.notify(me, 'afterDraw', [easingDecimal]); + plugins.notify(me, 'afterDraw', [easingValue]); }, /**