cornerstonejs / cornerstone3D

Cornerstone is a set of JavaScript libraries that can be used to build web-based medical imaging applications. It provides a framework to build radiology applications such as the OHIF Viewer.
https://cornerstonejs.org
MIT License
570 stars 290 forks source link

[Bug] Drawing brush works, but pointer freezes #809

Open jlopes90 opened 1 year ago

jlopes90 commented 1 year ago

It's possible? For example, I created a "keydown" event when clicking "control" and it ends up changing to "Circular Eraser" but it doesn't seem to be working. When I click "control" the brush gets stuck and doesn't move or paint.

jlopes90 commented 1 year ago

I found an example here: https://www.cornerstonejs.org/live-examples/modifierkeys

But there is a small problem: the circle doesn't move and it only paints or erases invisibly.

Here is the code I did like this:

cornerstoneTools.addTool(cornerstoneTools.SegmentationDisplayTool);
cornerstoneTools.addTool(cornerstoneTools.BrushTool);

const toolGroup = cornerstoneTools.ToolGroupManager.createToolGroup(toolGroupId);

toolGroup.addTool(cornerstoneTools.SegmentationDisplayTool.toolName);
toolGroup.addToolInstance(
  "CircularBrush",
  cornerstoneTools.BrushTool.toolName,
  {
    activeStrategy: "FILL_INSIDE_CIRCLE",
  }
);
toolGroup.addToolInstance(
  "CircularEraser",
  cornerstoneTools.BrushTool.toolName,
  {
    activeStrategy: "ERASE_INSIDE_CIRCLE",
  }
);

toolGroup.setToolActive("CircularBrush", {
  bindings: [
    {
      mouseButton: cornerstoneTools.Enums.MouseBindings.Primary // Left Click
    }
  ],
});
toolGroup.setToolActive("CircularEraser", {
  bindings: [
    {
      mouseButton: cornerstoneTools.Enums.MouseBindings.Primary, // Left Click
      modifierKey: cornerstoneTools.Enums.KeyboardBindings.Ctrl
    }
  ],
});
sedghi commented 1 year ago

Hmmm, that might be a bug that we have, thanks for the report