@cornerstonejs/tools 1.28.1 → 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/dist/cjs/stateManagement/annotation/config/ToolStyle.js +23 -18
- package/dist/cjs/stateManagement/annotation/config/ToolStyle.js.map +1 -1
- package/dist/cjs/store/SynchronizerManager/Synchronizer.js +4 -1
- package/dist/cjs/store/SynchronizerManager/Synchronizer.js.map +1 -1
- package/dist/cjs/tools/CrosshairsTool.d.ts +1 -1
- package/dist/cjs/tools/CrosshairsTool.js +7 -1
- package/dist/cjs/tools/CrosshairsTool.js.map +1 -1
- package/dist/cjs/types/ISynchronizerEventHandler.d.ts +1 -1
- package/dist/esm/stateManagement/annotation/config/ToolStyle.js +23 -18
- package/dist/esm/stateManagement/annotation/config/ToolStyle.js.map +1 -1
- package/dist/esm/store/SynchronizerManager/Synchronizer.js +4 -1
- package/dist/esm/store/SynchronizerManager/Synchronizer.js.map +1 -1
- package/dist/esm/tools/CrosshairsTool.d.ts +1 -1
- package/dist/esm/tools/CrosshairsTool.js +7 -1
- package/dist/esm/tools/CrosshairsTool.js.map +1 -1
- package/dist/esm/types/ISynchronizerEventHandler.d.ts +1 -1
- package/dist/umd/index.js +1 -1
- package/dist/umd/index.js.map +1 -1
- package/package.json +3 -3
- package/src/stateManagement/annotation/config/ToolStyle.ts +33 -18
- package/src/store/SynchronizerManager/Synchronizer.ts +12 -8
- package/src/tools/CrosshairsTool.ts +13 -1
- package/src/types/ISynchronizerEventHandler.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cornerstonejs/tools",
|
|
3
|
-
"version": "1.28.
|
|
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.
|
|
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": "
|
|
55
|
+
"gitHead": "6afa11385606812dd212aec3005e85c58665f982"
|
|
56
56
|
}
|
|
@@ -193,56 +193,71 @@ class ToolStyle {
|
|
|
193
193
|
toolName: string
|
|
194
194
|
) {
|
|
195
195
|
if (annotationUID) {
|
|
196
|
-
const
|
|
196
|
+
const annotationToolStyles = this.getAnnotationToolStyles(annotationUID);
|
|
197
197
|
|
|
198
|
-
if (
|
|
198
|
+
if (annotationToolStyles) {
|
|
199
199
|
// check first in the toolSpecific styles
|
|
200
|
-
if (
|
|
201
|
-
return
|
|
200
|
+
if (annotationToolStyles[property] !== undefined) {
|
|
201
|
+
return annotationToolStyles[property];
|
|
202
202
|
}
|
|
203
203
|
}
|
|
204
204
|
}
|
|
205
205
|
|
|
206
206
|
if (viewportId) {
|
|
207
|
-
const
|
|
207
|
+
const viewportToolStyles = this.getViewportToolStyles(viewportId);
|
|
208
208
|
|
|
209
|
-
if (
|
|
209
|
+
if (viewportToolStyles) {
|
|
210
210
|
// check if we have the viewportId specific style
|
|
211
211
|
// check first in the toolSpecific styles
|
|
212
|
-
if (
|
|
213
|
-
|
|
212
|
+
if (
|
|
213
|
+
viewportToolStyles[toolName] &&
|
|
214
|
+
viewportToolStyles[toolName][property] !== undefined
|
|
215
|
+
) {
|
|
216
|
+
return viewportToolStyles[toolName][property];
|
|
214
217
|
}
|
|
215
218
|
|
|
216
219
|
// check if we have the style in the viewport specific global viewportSpecificStyles
|
|
217
|
-
if (
|
|
218
|
-
|
|
220
|
+
if (
|
|
221
|
+
viewportToolStyles.global &&
|
|
222
|
+
viewportToolStyles.global[property] !== undefined
|
|
223
|
+
) {
|
|
224
|
+
return viewportToolStyles.global[property];
|
|
219
225
|
}
|
|
220
226
|
}
|
|
221
227
|
}
|
|
222
228
|
|
|
223
229
|
if (toolGroupId) {
|
|
224
|
-
const
|
|
230
|
+
const toolGroupToolStyles = this.getToolGroupToolStyles(toolGroupId);
|
|
225
231
|
|
|
226
|
-
if (
|
|
232
|
+
if (toolGroupToolStyles) {
|
|
227
233
|
// check first in the toolSpecific styles
|
|
228
|
-
if (
|
|
229
|
-
|
|
234
|
+
if (
|
|
235
|
+
toolGroupToolStyles[toolName] &&
|
|
236
|
+
toolGroupToolStyles[toolName][property] !== undefined
|
|
237
|
+
) {
|
|
238
|
+
return toolGroupToolStyles[toolName][property];
|
|
230
239
|
}
|
|
231
240
|
|
|
232
241
|
// check if we have the style in the toolGroup specific global styles
|
|
233
|
-
if (
|
|
234
|
-
|
|
242
|
+
if (
|
|
243
|
+
toolGroupToolStyles.global &&
|
|
244
|
+
toolGroupToolStyles.global[property] !== undefined
|
|
245
|
+
) {
|
|
246
|
+
return toolGroupToolStyles.global[property];
|
|
235
247
|
}
|
|
236
248
|
}
|
|
237
249
|
}
|
|
238
250
|
|
|
239
251
|
const globalStyles = this.getDefaultToolStyles();
|
|
240
252
|
|
|
241
|
-
if (
|
|
253
|
+
if (
|
|
254
|
+
globalStyles[toolName] &&
|
|
255
|
+
globalStyles[toolName][property] !== undefined
|
|
256
|
+
) {
|
|
242
257
|
return globalStyles[toolName][property];
|
|
243
258
|
}
|
|
244
259
|
|
|
245
|
-
if (globalStyles.global && globalStyles.global[property]) {
|
|
260
|
+
if (globalStyles.global && globalStyles.global[property] !== undefined) {
|
|
246
261
|
return globalStyles.global[property];
|
|
247
262
|
}
|
|
248
263
|
}
|
|
@@ -215,15 +215,19 @@ class Synchronizer {
|
|
|
215
215
|
if (targetIsSource) {
|
|
216
216
|
continue;
|
|
217
217
|
}
|
|
218
|
-
|
|
219
|
-
this
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
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
|
-
|
|
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) => {
|