From: Josh Kelley Date: Sun, 16 Nov 2025 18:42:40 +0000 (-0500) Subject: Use integer canvas dimensions (#12142) X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2898a6d1c76e15c56690dc41be5f91a44a1e85b9;p=thirdparty%2FChart.js.git Use integer canvas dimensions (#12142) --- diff --git a/src/helpers/helpers.dom.ts b/src/helpers/helpers.dom.ts index 8224361c6..b0c41eec0 100644 --- a/src/helpers/helpers.dom.ts +++ b/src/helpers/helpers.dom.ts @@ -227,12 +227,14 @@ export function retinaScale( canvas.style.width = `${chart.width}px`; } + const canvasHeight = Math.floor(deviceHeight); + const canvasWidth = Math.floor(deviceWidth); if (chart.currentDevicePixelRatio !== pixelRatio - || canvas.height !== deviceHeight - || canvas.width !== deviceWidth) { + || canvas.height !== canvasHeight + || canvas.width !== canvasWidth) { (chart as PrivateChart).currentDevicePixelRatio = pixelRatio; - canvas.height = deviceHeight; - canvas.width = deviceWidth; + canvas.height = canvasHeight; + canvas.width = canvasWidth; chart.ctx.setTransform(pixelRatio, 0, 0, pixelRatio, 0, 0); return true; }