radames commited on
Commit
e1c2d33
1 Parent(s): 4b9b93b

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +3 -2
index.html CHANGED
@@ -168,6 +168,7 @@
168
  if (!hasImage || isEmbedding || isSegmenting) {
169
  return;
170
  }
 
171
  const targetBox = event.target.getBoundingClientRect();
172
  const x = (event.clientX - targetBox.left) / targetBox.width;
173
  const y = (event.clientY - targetBox.top) / targetBox.height;
@@ -181,10 +182,10 @@
181
  if (ptsToRemove.length > 0) {
182
  pointArr = pointArr.filter((_, idx) => !ptsToRemove.includes(idx));
183
  } else {
184
- pointArr = [...pointArr, [x, y, !bgPointMode]];
185
  }
186
  undoBtn.disabled = false;
187
- if(pointArr.length == 0) {
188
  ctxMask.clearRect(0, 0, canvas.width, canvas.height);
189
  undoBtn.disabled = true;
190
  return;
 
168
  if (!hasImage || isEmbedding || isSegmenting) {
169
  return;
170
  }
171
+ const backgroundMode = event.shiftKey ? bgPointMode^event.shiftKey : bgPointMode;
172
  const targetBox = event.target.getBoundingClientRect();
173
  const x = (event.clientX - targetBox.left) / targetBox.width;
174
  const y = (event.clientY - targetBox.top) / targetBox.height;
 
182
  if (ptsToRemove.length > 0) {
183
  pointArr = pointArr.filter((_, idx) => !ptsToRemove.includes(idx));
184
  } else {
185
+ pointArr = [...pointArr, [x, y, !backgroundMode]];
186
  }
187
  undoBtn.disabled = false;
188
+ if (pointArr.length == 0) {
189
  ctxMask.clearRect(0, 0, canvas.width, canvas.height);
190
  undoBtn.disabled = true;
191
  return;