@cornerstonejs/tools 1.28.2 → 1.28.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cornerstonejs/tools",
3
- "version": "1.28.2",
3
+ "version": "1.28.3",
4
4
  "description": "Cornerstone3D Tools",
5
5
  "main": "src/index.ts",
6
6
  "types": "dist/esm/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.28.2",
32
+ "@cornerstonejs/core": "^1.28.3",
33
33
  "lodash.clonedeep": "4.5.0",
34
34
  "lodash.get": "^4.4.2"
35
35
  },
@@ -52,5 +52,5 @@
52
52
  "type": "individual",
53
53
  "url": "https://ohif.org/donate"
54
54
  },
55
- "gitHead": "dde6ed05ccc26a500ed7432c3afdf98a6dffdabf"
55
+ "gitHead": "6afa11385606812dd212aec3005e85c58665f982"
56
56
  }
@@ -215,15 +215,19 @@ class Synchronizer {
215
215
  if (targetIsSource) {
216
216
  continue;
217
217
  }
218
- promises.push(
219
- this._eventHandler(
220
- this,
221
- sourceViewport,
222
- targetViewport,
223
- sourceEvent,
224
- this._options
225
- )
218
+ const result = this._eventHandler(
219
+ this,
220
+ sourceViewport,
221
+ targetViewport,
222
+ sourceEvent,
223
+ this._options
226
224
  );
225
+
226
+ // if the result is a promise, then add it to the list of promises
227
+ // to wait for before setting _ignoreFiredEvents to false
228
+ if (result instanceof Promise) {
229
+ promises.push(result);
230
+ }
227
231
  }
228
232
  } catch (ex) {
229
233
  console.warn(`Synchronizer, for: ${this._eventName}`, ex);
@@ -1432,7 +1432,19 @@ class CrosshairsTool extends AnnotationTool {
1432
1432
 
1433
1433
  _getAnnotations = (enabledElement: Types.IEnabledElement) => {
1434
1434
  const { viewport } = enabledElement;
1435
- return getAnnotations(this.getToolName(), viewport.element);
1435
+ const annotations =
1436
+ getAnnotations(this.getToolName(), viewport.element) || [];
1437
+ const viewportIds = this._getViewportsInfo().map(
1438
+ ({ viewportId }) => viewportId
1439
+ );
1440
+
1441
+ // filter the annotations to only keep that are for this toolGroup
1442
+ const toolGroupAnnotations = annotations.filter((annotation) => {
1443
+ const { data } = annotation;
1444
+ return viewportIds.includes(data.viewportId);
1445
+ });
1446
+
1447
+ return toolGroupAnnotations;
1436
1448
  };
1437
1449
 
1438
1450
  _onNewVolume = (e: any) => {
@@ -8,5 +8,5 @@ export default interface ISynchronizerEventHandler {
8
8
  targetViewport: Types.IViewportId,
9
9
  sourceEvent: any,
10
10
  options?: any
11
- ): void;
11
+ ): Promise<void> | void;
12
12
  }