From 65ec3ef6baadcccd56dd7b0aaad5e6e7210bee96 Mon Sep 17 00:00:00 2001 From: liub <471071362@qq.com> Date: Sat, 30 Sep 2017 15:30:27 +0800 Subject: [PATCH] some suggestions --- simpleheat.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/simpleheat.js b/simpleheat.js index dc06eb9..7372165 100644 --- a/simpleheat.js +++ b/simpleheat.js @@ -111,6 +111,10 @@ simpleheat.prototype = { } // colorize the heatmap, using opacity value of each pixel to get the right color from our gradient + //some time,the canvas's width and height may be zero + if(this._width==0||this._height==0){ + this.resize(); + } var colored = ctx.getImageData(0, 0, this._width, this._height); this._colorize(colored.data, this._grad); ctx.putImageData(colored, 0, 0);