remove previous canvas elements
This commit is contained in:
@@ -18,6 +18,11 @@ export default class GameWindow {
|
|||||||
// Get canvas wrapper
|
// Get canvas wrapper
|
||||||
this.wrapper = document.getElementById(this.canvasWrapperId);
|
this.wrapper = document.getElementById(this.canvasWrapperId);
|
||||||
|
|
||||||
|
// Remove all children of wrapper
|
||||||
|
while (this.wrapper.firstChild) {
|
||||||
|
this.wrapper.removeChild(this.wrapper.firstChild);
|
||||||
|
}
|
||||||
|
|
||||||
// Create world renderer
|
// Create world renderer
|
||||||
this.canvas = document.createElement('canvas');
|
this.canvas = document.createElement('canvas');
|
||||||
this.wrapper.appendChild(this.canvas);
|
this.wrapper.appendChild(this.canvas);
|
||||||
|
|||||||
Reference in New Issue
Block a user