From 2898a6d1c76e15c56690dc41be5f91a44a1e85b9 Mon Sep 17 00:00:00 2001 From: Josh Kelley Date: Sun, 16 Nov 2025 13:42:40 -0500 Subject: [PATCH] Use integer canvas dimensions (#12142) --- src/helpers/helpers.dom.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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; } -- 2.47.3