mirror of
https://github.com/chartjs/Chart.js.git
synced 2025-12-08 20:36:08 +00:00
fix canvas clearRect size calculation (#8328)
Co-authored-by: Marcel Samyn <marcel.samyn@lab900.com>
This commit is contained in:
parent
06fa8a4c98
commit
ff19ea4be7
@ -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) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user