mirror of
https://github.com/chartjs/Chart.js.git
synced 2026-03-04 23:44:05 +01:00
fix canvas clearRect size calculation (#8328)
Co-authored-by: Marcel Samyn <marcel.samyn@lab900.com>
This commit is contained in:
@@ -113,7 +113,13 @@ export function _alignPixel(chart, pixel, width) {
|
||||
*/
|
||||
export function clearCanvas(canvas, ctx) {
|
||||
ctx = ctx || canvas.getContext('2d');
|
||||
|
||||
ctx.save();
|
||||
// canvas.width and canvas.height do not consider the canvas transform,
|
||||
// while clearRect does
|
||||
ctx.resetTransform();
|
||||
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
||||
ctx.restore();
|
||||
}
|
||||
|
||||
export function drawPoint(ctx, options, x, y) {
|
||||
|
||||
Reference in New Issue
Block a user