Fixing not recreating canvas context if it already exists.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Adsooi 2025-01-12 18:08:44 +01:00
parent 54f82eab92
commit 2c8011056d
Signed by: Ad5001
GPG key ID: EF45F9C6AFE20160

View file

@ -212,8 +212,9 @@ class CanvasAPI extends Module {
*/
redraw() {
if(!this.initialized) throw new Error("Attempting redraw before initialize!")
this.#redrawCount = (this.#redrawCount + 1) % 10000
if(this.#ctx == null)
this.#ctx = this.#canvas.getContext("2d")
this.#redrawCount = (this.#redrawCount + 1) % 10000
this._computeAxes()
this._reset()
this._drawGrid()