From 5546c35752b81f05b0bf67f4827fb4873ba8199f Mon Sep 17 00:00:00 2001 From: Ovilia Date: Mon, 20 Dec 2021 15:05:34 +0800 Subject: [PATCH] fix: maxRadius to avoid overflow --- src/wordcloud2.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wordcloud2.js b/src/wordcloud2.js index 9d4c143..c5c018a 100644 --- a/src/wordcloud2.js +++ b/src/wordcloud2.js @@ -1053,7 +1053,7 @@ if (!window.clearImmediate) { : [ngx / 2, ngy / 2] // Maxium radius to look for space - maxRadius = Math.floor(Math.sqrt(ngx * ngx + ngy * ngy)) + maxRadius = Math.floor(Math.max(ngx, ngy) / 2) /* Clear the canvas only if the clearCanvas is set, if not, update the grid to the current canvas state */