From 2c8011056de43b28b8be01274dcbff8efd120fa2 Mon Sep 17 00:00:00 2001 From: Ad5001 Date: Sun, 12 Jan 2025 18:08:44 +0100 Subject: [PATCH] Fixing not recreating canvas context if it already exists. --- common/src/module/canvas.mjs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/src/module/canvas.mjs b/common/src/module/canvas.mjs index dcc3f33..22166d5 100644 --- a/common/src/module/canvas.mjs +++ b/common/src/module/canvas.mjs @@ -212,8 +212,9 @@ class CanvasAPI extends Module { */ redraw() { if(!this.initialized) throw new Error("Attempting redraw before initialize!") + if(this.#ctx == null) + this.#ctx = this.#canvas.getContext("2d") this.#redrawCount = (this.#redrawCount + 1) % 10000 - this.#ctx = this.#canvas.getContext("2d") this._computeAxes() this._reset() this._drawGrid()