remove previous canvas elements

This commit is contained in:
LabyStudio
2022-05-13 21:46:55 +02:00
parent 02497c2d36
commit aed8c401ac
@@ -18,6 +18,11 @@ export default class GameWindow {
// Get canvas wrapper
this.wrapper = document.getElementById(this.canvasWrapperId);
// Remove all children of wrapper
while (this.wrapper.firstChild) {
this.wrapper.removeChild(this.wrapper.firstChild);
}
// Create world renderer
this.canvas = document.createElement('canvas');
this.wrapper.appendChild(this.canvas);