Changing the width or height of a canvas element will remove its contents and reset all the properties (like fillstyle) of its drawing context to their default values. You don’t even need to change the width; you can simply set it to its current value, like this:
var canvas = document.getElementById("mycanvas");
canvas.width = canvas.width;
not work for me.
ReplyDelete