@cornerstonejs/tools 3.30.1 → 3.30.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.
@@ -91,10 +91,7 @@ export default class ToolGroup {
91
91
  });
92
92
  }
93
93
  const toolName = this.getActivePrimaryMouseButtonTool();
94
- const runtimeSettings = Settings.getRuntimeSettings();
95
- if (runtimeSettings.get('useCursors')) {
96
- this.setViewportsCursorByToolName(toolName);
97
- }
94
+ this.setViewportsCursorByToolName(toolName);
98
95
  const eventDetail = {
99
96
  toolGroupId: this.id,
100
97
  viewportId,
@@ -190,18 +187,16 @@ export default class ToolGroup {
190
187
  };
191
188
  this.toolOptions[toolName] = toolOptions;
192
189
  this._toolInstances[toolName].mode = Active;
193
- const runtimeSettings = Settings.getRuntimeSettings();
194
- const useCursor = runtimeSettings.get('useCursors');
195
- if (this._hasMousePrimaryButtonBinding(toolBindingsOptions) && useCursor) {
196
- this.setViewportsCursorByToolName(toolName);
197
- }
198
- else {
190
+ if (!this._hasMousePrimaryButtonBinding(toolBindingsOptions)) {
199
191
  const activeToolIdentifier = this.getActivePrimaryMouseButtonTool();
200
- if (!activeToolIdentifier && useCursor) {
192
+ if (!activeToolIdentifier) {
201
193
  const cursor = MouseCursor.getDefinedCursor('default');
202
194
  this._setCursorForViewports(cursor);
203
195
  }
204
196
  }
197
+ else {
198
+ this.setViewportsCursorByToolName(toolName);
199
+ }
205
200
  if (this._hasMousePrimaryButtonBinding(toolBindingsOptions)) {
206
201
  if (this.prevActivePrimaryToolName === null) {
207
202
  this.prevActivePrimaryToolName = toolName;
@@ -331,6 +326,10 @@ export default class ToolGroup {
331
326
  return MouseCursor.getDefinedCursor('default');
332
327
  }
333
328
  _setCursorForViewports(cursor) {
329
+ const runtimeSettings = Settings.getRuntimeSettings();
330
+ if (!runtimeSettings.get('useCursors')) {
331
+ return;
332
+ }
334
333
  this.viewportsInfo.forEach(({ renderingEngineId, viewportId }) => {
335
334
  const enabledElement = getEnabledElementByIds(viewportId, renderingEngineId);
336
335
  if (!enabledElement) {
@@ -68,6 +68,8 @@ export default class LabelmapBaseTool extends BaseTool {
68
68
  constructor(toolProps: any, defaultToolProps: any);
69
69
  protected _historyRedoHandler(evt: any): void;
70
70
  protected get _previewData(): PreviewData;
71
+ hasPreviewData(): boolean;
72
+ shouldResolvePreviewRequests(): boolean;
71
73
  createMemo(segmentationId: string, segmentationVoxelManager: any): LabelmapMemo.LabelmapMemo;
72
74
  protected createEditData(element: any): EditDataReturnType;
73
75
  protected getEditData({ viewport, representationData, segmentsLocked, segmentationId, }: {
@@ -54,6 +54,13 @@ export default class LabelmapBaseTool extends BaseTool {
54
54
  get _previewData() {
55
55
  return LabelmapBaseTool.previewData;
56
56
  }
57
+ hasPreviewData() {
58
+ return !!this._previewData.preview;
59
+ }
60
+ shouldResolvePreviewRequests() {
61
+ return ((this.mode === 'Active' || this.mode === 'Enabled') &&
62
+ this.hasPreviewData());
63
+ }
57
64
  createMemo(segmentationId, segmentationVoxelManager) {
58
65
  const voxelManagerId = segmentationVoxelManager.id;
59
66
  if (this.memo &&
@@ -229,6 +236,10 @@ export default class LabelmapBaseTool extends BaseTool {
229
236
  const enabledElement = getEnabledElement(element);
230
237
  const results = this.applyActiveStrategyCallback(enabledElement, this.getOperationData(element), StrategyCallbacks.AddPreview);
231
238
  _previewData.isDrag = true;
239
+ if (results?.modified) {
240
+ _previewData.preview = results;
241
+ _previewData.element = element;
242
+ }
232
243
  return results;
233
244
  }
234
245
  rejectPreview(element = this._previewData.element) {
@@ -37,6 +37,7 @@ export type InitializedOperationData = LabelmapToolOperationDataAny & {
37
37
  };
38
38
  };
39
39
  memo?: LabelmapMemo;
40
+ modified?: boolean;
40
41
  };
41
42
  export type StrategyFunction = (operationData: InitializedOperationData, ...args: any[]) => unknown;
42
43
  export type CompositionInstance = {
@@ -18,6 +18,7 @@ export default {
18
18
  },
19
19
  [StrategyCallbacks.Initialize]: (operationData) => {
20
20
  const { segmentIndex, previewColor, previewSegmentIndex } = operationData;
21
+ operationData.modified = false;
21
22
  if (previewSegmentIndex == null || segmentIndex == null) {
22
23
  return;
23
24
  }
@@ -25,6 +26,7 @@ export default {
25
26
  viewportIds?.forEach((viewportId) => {
26
27
  setSegmentIndexColor(viewportId, operationData.segmentationId, previewSegmentIndex, previewColor);
27
28
  });
29
+ operationData.modified = true;
28
30
  },
29
31
  [StrategyCallbacks.AcceptPreview]: (operationData) => {
30
32
  const { previewSegmentIndex, segmentationVoxelManager, memo, segmentIndex, centerSegmentIndexInfo, } = operationData || {};
@@ -1 +1 @@
1
- export declare const version = "3.30.1";
1
+ export declare const version = "3.30.3";
@@ -1 +1 @@
1
- export const version = '3.30.1';
1
+ export const version = '3.30.3';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cornerstonejs/tools",
3
- "version": "3.30.1",
3
+ "version": "3.30.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.1.0"
109
109
  },
110
110
  "peerDependencies": {
111
- "@cornerstonejs/core": "^3.30.1",
111
+ "@cornerstonejs/core": "^3.30.3",
112
112
  "@kitware/vtk.js": "32.12.1",
113
113
  "@types/d3-array": "^3.0.4",
114
114
  "@types/d3-interpolate": "^3.0.1",
@@ -127,5 +127,5 @@
127
127
  "type": "individual",
128
128
  "url": "https://ohif.org/donate"
129
129
  },
130
- "gitHead": "1ac2366db0ddd23ef7d269192eb6ce233d32bd2a"
130
+ "gitHead": "ff959f1bf57c60b727e2cd6563db13b194cbabb0"
131
131
  }