5 ms·
It's not really. The code smell is people using it to clear rather than using clearRect but the fact that setting canvas.width or canvas.height resets the canva
by greggman3 5y ago
It's not really. The code smell is people using it to clear rather than using clearRect but the fact that setting canvas.width or canvas.height resets the canvas and even does so if the size is the same is good engineering IMO.
It's consistent and so your code can know if it sets the size things will reset. It doesn't have to special case when you happen to set it to the same size.