Shengyi Zhou commited on
Commit
95d2cb9
·
1 Parent(s): 827a029

fix: keep click markers on the selected slice

Browse files
Files changed (1) hide show
  1. frontend/app.js +11 -1
frontend/app.js CHANGED
@@ -447,7 +447,7 @@ function drawView(viewName, canvas) {
447
 
448
  function drawPromptOverlay(context, viewName, width, height, sourceWidth, sourceHeight) {
449
  const prompt = state.pendingPrompt || state.lastPrompt;
450
- if (!prompt || prompt.view !== viewName) {
451
  return;
452
  }
453
 
@@ -468,6 +468,16 @@ function drawPromptOverlay(context, viewName, width, height, sourceWidth, source
468
  context.stroke();
469
  }
470
 
 
 
 
 
 
 
 
 
 
 
471
  function extractSlice(viewName, sliceIndex) {
472
  const [dimX, dimY, dimZ] = state.dims;
473
  let width = 0;
 
447
 
448
  function drawPromptOverlay(context, viewName, width, height, sourceWidth, sourceHeight) {
449
  const prompt = state.pendingPrompt || state.lastPrompt;
450
+ if (!prompt || prompt.view !== viewName || !promptMatchesSlice(viewName, prompt.xyz)) {
451
  return;
452
  }
453
 
 
468
  context.stroke();
469
  }
470
 
471
+ function promptMatchesSlice(viewName, xyz) {
472
+ if (viewName === "axial") {
473
+ return xyz[2] === state.slices.axial;
474
+ }
475
+ if (viewName === "coronal") {
476
+ return xyz[1] === state.slices.coronal;
477
+ }
478
+ return xyz[0] === state.slices.sagittal;
479
+ }
480
+
481
  function extractSlice(viewName, sliceIndex) {
482
  const [dimX, dimY, dimZ] = state.dims;
483
  let width = 0;