canvas-recorder icon indicating copy to clipboard operation
canvas-recorder copied to clipboard

Clearing does not consider transform

Open roboshoes opened this issue 5 years ago • 0 comments

When the canvas has a transform applied, let's say context.translate( 10, 10 ) then the clearing will be off by 10 pixels as it's done via context.clearRect( 0, 0, canvas.width, canvas.height ).

A simple workaround is canvas.width = canvas.width though less performant.

Another solution would be:

context.save();
context.setTranfsorm( 1, 0, 0, 1 0, 0 );
context.clearRect( canvas.width, canvas.height );
context.restore();

roboshoes avatar Dec 07 '19 05:12 roboshoes