Skip to content

Commit 2c80110

Browse files
committed
Fixing not recreating canvas context if it already exists.
1 parent 54f82ea commit 2c80110

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

common/src/module/canvas.mjs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,9 @@ class CanvasAPI extends Module {
212212
*/
213213
redraw() {
214214
if(!this.initialized) throw new Error("Attempting redraw before initialize!")
215+
if(this.#ctx == null)
216+
this.#ctx = this.#canvas.getContext("2d")
215217
this.#redrawCount = (this.#redrawCount + 1) % 10000
216-
this.#ctx = this.#canvas.getContext("2d")
217218
this._computeAxes()
218219
this._reset()
219220
this._drawGrid()

0 commit comments

Comments
 (0)