radames commited on
Commit
6467b4b
1 Parent(s): e1c2d33

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +7 -6
index.html CHANGED
@@ -92,7 +92,7 @@
92
  const target = e.target;
93
  if (target.files.length > 0) {
94
  const href = URL.createObjectURL(target.files[0]);
95
- cleanImageCanvas();
96
  drawImageCanvas(href);
97
  setImageEmbeddings(href);
98
  togglePointMode(false);
@@ -118,12 +118,12 @@
118
 
119
  if (files.length > 0) {
120
  const href = URL.createObjectURL(files[0]);
121
- cleanImageCanvas();
122
  drawImageCanvas(href);
123
  setImageEmbeddings(href);
124
  togglePointMode(false);
125
  } else if (url) {
126
- cleanImageCanvas();
127
  drawImageCanvas(url);
128
  setImageEmbeddings(url);
129
  togglePointMode(false);
@@ -144,7 +144,7 @@
144
  const target = e.target;
145
  if (target.nodeName === "IMG") {
146
  const href = target.src;
147
- cleanImageCanvas();
148
  drawImageCanvas(href);
149
  setImageEmbeddings(href);
150
  }
@@ -155,7 +155,7 @@
155
  });
156
  //add event listener to clear button
157
  clearBtn.addEventListener("click", () => {
158
- cleanImageCanvas();
159
  togglePointMode(false);
160
  pointArr = [];
161
  });
@@ -259,13 +259,14 @@
259
  currentImageURL = imageURL;
260
  }
261
 
262
- function cleanImageCanvas() {
263
  ctxCanvas.clearRect(0, 0, canvas.width, canvas.height);
264
  ctxMask.clearRect(0, 0, canvas.width, canvas.height);
265
  hasImage = false;
266
  isEmbedding = false;
267
  isSegmenting = false;
268
  currentImageURL = "";
 
269
  clearBtn.disabled = true;
270
  canvas.parentElement.style.height = "auto";
271
  dropButtons.classList.remove("invisible");
 
92
  const target = e.target;
93
  if (target.files.length > 0) {
94
  const href = URL.createObjectURL(target.files[0]);
95
+ clearImageCanvas();
96
  drawImageCanvas(href);
97
  setImageEmbeddings(href);
98
  togglePointMode(false);
 
118
 
119
  if (files.length > 0) {
120
  const href = URL.createObjectURL(files[0]);
121
+ clearImageCanvas();
122
  drawImageCanvas(href);
123
  setImageEmbeddings(href);
124
  togglePointMode(false);
125
  } else if (url) {
126
+ clearImageCanvas();
127
  drawImageCanvas(url);
128
  setImageEmbeddings(url);
129
  togglePointMode(false);
 
144
  const target = e.target;
145
  if (target.nodeName === "IMG") {
146
  const href = target.src;
147
+ clearImageCanvas();
148
  drawImageCanvas(href);
149
  setImageEmbeddings(href);
150
  }
 
155
  });
156
  //add event listener to clear button
157
  clearBtn.addEventListener("click", () => {
158
+ clearImageCanvas();
159
  togglePointMode(false);
160
  pointArr = [];
161
  });
 
259
  currentImageURL = imageURL;
260
  }
261
 
262
+ function clearImageCanvas() {
263
  ctxCanvas.clearRect(0, 0, canvas.width, canvas.height);
264
  ctxMask.clearRect(0, 0, canvas.width, canvas.height);
265
  hasImage = false;
266
  isEmbedding = false;
267
  isSegmenting = false;
268
  currentImageURL = "";
269
+ pointArr = [];
270
  clearBtn.disabled = true;
271
  canvas.parentElement.style.height = "auto";
272
  dropButtons.classList.remove("invisible");