]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Use round when setting new chart size (#7221)
authoremmcbd <42184090+emmcbd@users.noreply.github.com>
Fri, 27 Mar 2020 23:46:34 +0000 (00:46 +0100)
committerGitHub <noreply@github.com>
Fri, 27 Mar 2020 23:46:34 +0000 (19:46 -0400)
src/core/core.controller.js

index 9e3c5fd7a10db4cafa6a3a42992a5ddfd41d8904..03dc499f532697c15cee2c81191f06c3edea31b8 100644 (file)
@@ -313,8 +313,8 @@ export default class Chart {
                // 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 collapsed
-               const newWidth = Math.max(0, Math.floor(width));
-               const newHeight = Math.max(0, Math.floor(aspectRatio ? newWidth / aspectRatio : height));
+               const newWidth = Math.max(0, Math.round(width));
+               const newHeight = Math.max(0, Math.round(aspectRatio ? newWidth / aspectRatio : height));
 
                // detect devicePixelRation changes
                const oldRatio = me.currentDevicePixelRatio;