When the width of a canvas changes, it clears the canvas' context. This means everything drawn goes away, as well as all other settings (stroke color, thickness, etc).
Add a way to save the state of the canvas before resizing the window, then restore it (properly, given the altered width) when resizing the canvas.
When the width of a canvas changes, it clears the canvas' context. This means everything drawn goes away, as well as all other settings (stroke color, thickness, etc).
Add a way to save the state of the canvas before resizing the window, then restore it (properly, given the altered width) when resizing the canvas.