Skip to content

Commit

Permalink
Bug: Avoid updating Chart when responsive: true and Chart is hidden. (
Browse files Browse the repository at this point in the history
#5172)

* Bug: Avoid updating Chart when `responsive: true` and Chart is hidden.

* Prevent `drawing` when width/height is invalid.
  • Loading branch information
jcopperfield authored and etimberg committed May 23, 2018
1 parent 1072ed9 commit 25b7f41
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/core/core.controller.js
Expand Up @@ -181,7 +181,7 @@ module.exports = function(Chart) {
// the canvas render width and height will be casted to integers so make sure that
// the canvas display style uses the same integer values to avoid blurring effect.

// Set to 0 instead of canvas.size because the size defaults to 300x150 if the element is collased
// Set to 0 instead of canvas.size because the size defaults to 300x150 if the element is collapsed
var newWidth = Math.max(0, Math.floor(helpers.getMaximumWidth(canvas)));
var newHeight = Math.max(0, Math.floor(aspectRatio ? newWidth / aspectRatio : helpers.getMaximumHeight(canvas)));

Expand Down Expand Up @@ -561,6 +561,10 @@ module.exports = function(Chart) {

me.transition(easingValue);

if (me.width <= 0 || me.height <= 0) {
return;
}

if (plugins.notify(me, 'beforeDraw', [easingValue]) === false) {
return;
}
Expand Down

0 comments on commit 25b7f41

Please sign in to comment.