@cornerstonejs/tools 1.43.5 → 1.43.6

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cornerstonejs/tools",
3
- "version": "1.43.5",
3
+ "version": "1.43.6",
4
4
  "description": "Cornerstone3D Tools",
5
5
  "main": "src/index.ts",
6
6
  "types": "dist/types/index.d.ts",
@@ -29,7 +29,7 @@
29
29
  "webpack:watch": "webpack --mode development --progress --watch --config ./.webpack/webpack.dev.js"
30
30
  },
31
31
  "dependencies": {
32
- "@cornerstonejs/core": "^1.43.5",
32
+ "@cornerstonejs/core": "^1.43.6",
33
33
  "comlink": "^4.4.1",
34
34
  "lodash.clonedeep": "4.5.0",
35
35
  "lodash.get": "^4.4.2"
@@ -53,5 +53,5 @@
53
53
  "type": "individual",
54
54
  "url": "https://ohif.org/donate"
55
55
  },
56
- "gitHead": "b63236689d4dc65ccfa11ba34a516991d17e726c"
56
+ "gitHead": "66da8823e7582d11c671c88902b2b2be8d6f9617"
57
57
  }
@@ -80,18 +80,18 @@ function addAnnotation(
80
80
  }
81
81
 
82
82
  const manager = getAnnotationManager();
83
- const groupKey = manager.getGroupKey(annotationGroupSelector);
84
-
85
- manager.addAnnotation(annotation, groupKey);
86
83
 
87
84
  // if the annotation manager selector is an element, trigger the
88
85
  // annotation added event for that element.
89
86
  if (annotationGroupSelector instanceof HTMLDivElement) {
87
+ const groupKey = manager.getGroupKey(annotationGroupSelector);
88
+ manager.addAnnotation(annotation, groupKey);
90
89
  triggerAnnotationAddedForElement(annotation, annotationGroupSelector);
91
90
  } else {
92
91
  // if no element is provided, render all viewports that have the
93
92
  // same frame of reference.
94
93
  // Todo: we should do something else here for other types of annotation managers.
94
+ manager.addAnnotation(annotation);
95
95
  triggerAnnotationAddedForFOR(annotation);
96
96
  }
97
97
 
@@ -41,14 +41,12 @@ function triggerAnnotationAddedForFOR(annotation: Annotation) {
41
41
  const { toolName } = annotation.metadata;
42
42
 
43
43
  const toolGroups = getToolGroupsWithToolName(toolName);
44
-
45
44
  if (!toolGroups.length) {
46
45
  return;
47
46
  }
48
47
 
49
48
  // Find the viewports in the toolGroups who has the same FrameOfReferenceUID
50
49
  const viewportsToRender = [];
51
-
52
50
  toolGroups.forEach((toolGroup) => {
53
51
  toolGroup.viewportsInfo.forEach((viewportInfo) => {
54
52
  const { renderingEngineId, viewportId } = viewportInfo;
@@ -63,19 +61,17 @@ function triggerAnnotationAddedForFOR(annotation: Annotation) {
63
61
  });
64
62
  });
65
63
 
64
+ const eventType = Events.ANNOTATION_ADDED;
65
+ const eventDetail: AnnotationAddedEventDetail = { annotation };
66
+
66
67
  if (!viewportsToRender.length) {
68
+ triggerEvent(eventTarget, eventType, eventDetail);
67
69
  return;
68
70
  }
69
71
 
70
- const eventType = Events.ANNOTATION_ADDED;
71
-
72
72
  viewportsToRender.forEach(({ renderingEngineId, viewportId }) => {
73
- const eventDetail: AnnotationAddedEventDetail = {
74
- annotation,
75
- viewportId,
76
- renderingEngineId,
77
- };
78
-
73
+ eventDetail.viewportId = viewportId;
74
+ eventDetail.renderingEngineId = renderingEngineId;
79
75
  triggerEvent(eventTarget, eventType, eventDetail);
80
76
  });
81
77
  }
@@ -104,9 +104,9 @@ type ToolActivatedEventDetail = {
104
104
  */
105
105
  type AnnotationAddedEventDetail = {
106
106
  /** unique id of the viewport */
107
- viewportId: string;
107
+ viewportId?: string;
108
108
  /** unique id of the rendering engine */
109
- renderingEngineId: string;
109
+ renderingEngineId?: string;
110
110
  /** The annotation that is being added to the annotations manager. */
111
111
  annotation: Annotation;
112
112
  };