ZMYaro / paintz

A simple drawing app that runs in a web browser, designed to be an MS Paint substitute for Chromebooks and other Chrome OS devices. PaintZ is free, but please consider supporting development at https://ko-fi.com/ZMYaro or https://patreon.com/ZMYaro.
https://paintz.app
53 stars 11 forks source link

Switch to using ctx.reset() #249

Closed ZMYaro closed 1 year ago

ZMYaro commented 2 years ago

Switch to using CanvasRenderingContext2D.prototype.reset, and move the existing Utils.clearCanvas to a lazy polyfill for it.

https://github.com/fserb/canvas2D/blob/master/spec/reset.md

ZMYaro commented 1 year ago

Done in https://github.com/ZMYaro/paintz/commit/daddc168ecf7ffdeea3be1ffdb59b5de89b399e3.

ZMYaro commented 1 year ago

This is actually not ideal, as most of the times Utils.clearCanvas was used, only the contents of the canvas needed to be removed, and the other properties that context.reset reset did not need to be or were expected to remain untouched.