Skip to content

Commit

Permalink
Update simpleheat.js
Browse files Browse the repository at this point in the history
  • Loading branch information
victorperezpiqueras authored May 10, 2023
1 parent c1998c3 commit 2f6e161
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions simpleheat.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,11 @@ simpleheat.prototype = {
}

// colorize the heatmap, using opacity value of each pixel to get the right color from our gradient
var colored = ctx.getImageData(0, 0, this._width, this._height);
this._colorize(colored.data, this._grad);
ctx.putImageData(colored, 0, 0);
if (this._width != 0 && this._height != 0) {
var colored = ctx.getImageData(0, 0, this._width, this._height);
this._colorize(colored.data, this._grad);
ctx.putImageData(colored, 0, 0);
}

return this;
},
Expand Down

0 comments on commit 2f6e161

Please sign in to comment.