@cornerstonejs/tools 4.13.1 → 4.13.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -193,9 +193,11 @@ export default class ToolGroup {
193
193
  const cursor = MouseCursor.getDefinedCursor('default');
194
194
  this._setCursorForViewports(cursor);
195
195
  }
196
+ toolInstance.isPrimary = false;
196
197
  }
197
198
  else {
198
199
  this.setViewportsCursorByToolName(toolName);
200
+ toolInstance.isPrimary = true;
199
201
  }
200
202
  if (this._hasMousePrimaryButtonBinding(toolBindingsOptions)) {
201
203
  if (this.prevActivePrimaryToolName === null) {
@@ -242,6 +244,7 @@ export default class ToolGroup {
242
244
  }
243
245
  this.toolOptions[toolName] = toolOptions;
244
246
  toolInstance.mode = mode;
247
+ toolInstance.isPrimary = false;
245
248
  if (typeof toolInstance.onSetToolPassive === 'function') {
246
249
  toolInstance.onSetToolPassive();
247
250
  }
@@ -5,10 +5,12 @@ import type StrategyCallbacks from '../../enums/StrategyCallbacks';
5
5
  import type { InteractionTypes, ToolProps, PublicToolProps } from '../../types';
6
6
  declare abstract class BaseTool {
7
7
  static toolName: any;
8
+ static activeCursorTool: any;
8
9
  supportedInteractionTypes: InteractionTypes[];
9
10
  configuration: Record<string, any>;
10
11
  toolGroupId: string;
11
12
  mode: ToolModes;
13
+ isPrimary: boolean;
12
14
  protected memo: csUtils.HistoryMemo.Memo;
13
15
  static defaults: {
14
16
  configuration: {
@@ -11,6 +11,7 @@ class BaseTool {
11
11
  },
12
12
  }; }
13
13
  constructor(toolProps, defaultToolProps) {
14
+ this.isPrimary = false;
14
15
  const mergedDefaults = BaseTool.mergeDefaultProps(BaseTool.defaults, defaultToolProps);
15
16
  const initialProps = csUtils.deepMerge(mergedDefaults, toolProps);
16
17
  const { configuration = {}, supportedInteractionTypes, toolGroupId, } = initialProps;
@@ -5,7 +5,6 @@ import { fillInsideSphere, thresholdInsideSphere, thresholdInsideSphereIsland, }
5
5
  import { eraseInsideSphere } from './strategies/eraseSphere';
6
6
  import { thresholdInsideCircle, fillInsideCircle, } from './strategies/fillCircle';
7
7
  import { eraseInsideCircle } from './strategies/eraseCircle';
8
- import { drawCircle as drawCircleSvg } from '../../drawingSvg';
9
8
  import { resetElementCursor, hideElementCursor, } from '../../cursors/elementCursor';
10
9
  import triggerAnnotationRenderForViewportUIDs from '../../utilities/triggerAnnotationRenderForViewportIds';
11
10
  import LabelmapBaseTool from './LabelmapBaseTool';
@@ -120,6 +119,9 @@ class BrushTool extends LabelmapBaseTool {
120
119
  return true;
121
120
  };
122
121
  this.mouseMoveCallback = (evt) => {
122
+ if (!this.isPrimary) {
123
+ return;
124
+ }
123
125
  if (this.mode === ToolModes.Active) {
124
126
  this.updateCursor(evt);
125
127
  if (!this.configuration.preview.enabled) {
@@ -286,6 +288,7 @@ class BrushTool extends LabelmapBaseTool {
286
288
  if (!this._hoverData) {
287
289
  return;
288
290
  }
291
+ BrushTool.activeCursorTool = this;
289
292
  triggerAnnotationRenderForViewportUIDs(this._hoverData.viewportIdsToRender);
290
293
  }
291
294
  _calculateCursor(element, centerCanvas) {
@@ -338,7 +341,7 @@ class BrushTool extends LabelmapBaseTool {
338
341
  this._hoverData.brushCursor.metadata.segmentColor = segmentColor;
339
342
  }
340
343
  renderAnnotation(enabledElement, svgDrawingHelper) {
341
- if (!this._hoverData) {
344
+ if (!this._hoverData || BrushTool.activeCursorTool !== this) {
342
345
  return;
343
346
  }
344
347
  const { viewport } = enabledElement;
@@ -1 +1 @@
1
- export declare const version = "4.13.1";
1
+ export declare const version = "4.13.3";
@@ -1 +1 @@
1
- export const version = '4.13.1';
1
+ export const version = '4.13.3';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cornerstonejs/tools",
3
- "version": "4.13.1",
3
+ "version": "4.13.3",
4
4
  "description": "Cornerstone3D Tools",
5
5
  "types": "./dist/esm/index.d.ts",
6
6
  "module": "./dist/esm/index.js",
@@ -108,7 +108,7 @@
108
108
  "canvas": "3.2.0"
109
109
  },
110
110
  "peerDependencies": {
111
- "@cornerstonejs/core": "4.13.1",
111
+ "@cornerstonejs/core": "4.13.3",
112
112
  "@kitware/vtk.js": "34.15.1",
113
113
  "@types/d3-array": "3.2.1",
114
114
  "@types/d3-interpolate": "3.0.4",
@@ -127,5 +127,5 @@
127
127
  "type": "individual",
128
128
  "url": "https://ohif.org/donate"
129
129
  },
130
- "gitHead": "8fe7f5e867c51affcbf8f0647b13b42e08754db7"
130
+ "gitHead": "97b7d22e28d3caa6f8d6d43a5b37689e4ceea521"
131
131
  }