Skip to content

Commit 0b404f5

Browse files
committed
remove the canvas if the user upload a new marker
1 parent aa16880 commit 0b404f5

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

dist/ARFset.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/ARFset.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ export default class ARFset {
6363
const scope = (typeof window !== 'undefined') ? window : global
6464
scope.arfset = this
6565
this._setup()
66+
this._createCanvas();
6667
return this;
6768
}
6869

@@ -79,16 +80,20 @@ export default class ARFset {
7980

8081
_createCanvas() {
8182
if (typeof document !== "undefined") {
83+
if (document.getElementById('iSet')) {
84+
document.getElementById('iSet').remove()
85+
}
8286
this.canvas = document.createElement("canvas");
8387
this.canvas.id = "iSet";
8488
this.ctx = this.canvas.getContext("2d");
89+
document.body.appendChild(this.canvas);
8590
console.log('canvas created');
8691
};
8792
}
8893

8994
display () {
90-
this._createCanvas();
91-
document.body.appendChild(this.canvas);
95+
96+
9297
var self = this;
9398
document.addEventListener('nftMarker', function(ev) {
9499
self.canvas.width = ev.detail.widthNFT;

0 commit comments

Comments
 (0)