@cornerstonejs/tools 2.2.2 → 2.2.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.
@@ -30,6 +30,7 @@ const RECTANGLE_ICON = `<path fill="{{color}}" d="M8.86,2.25V66.08H72.69V2.25H8.
30
30
  const CIRCLE_ICON = `<path fill="{{color}}" d="M40.77,2.25A31.92,31.92,0,1,0,72.69,34.16,31.92,31.92,0,0,0,40.77,2.25Zm0,57.63A25.71,25.71,0,1,1,66.48,34.16,25.71,25.71,0,0,1,40.77,59.87Z" transform="translate(-8.86 -2.25)"/>`;
31
31
  const CursorSVG = {
32
32
  Angle: extend(BASE, {
33
+ name: 'Angle',
33
34
  iconContent: `<path fill="{{color}}" d="M1203 544q0 13-10 23l-393 393 393 393q10 10 10 23t-10 23l-50
34
35
  50q-10 10-23 10t-23-10l-466-466q-10-10-10-23t10-23l466-466q10-10 23-10t23
35
36
  10l50 50q10 10 10 23z" />`,
@@ -39,6 +40,7 @@ const CursorSVG = {
39
40
  },
40
41
  }),
41
42
  ArrowAnnotate: extend(BASE, {
43
+ name: 'ArrowAnnotate',
42
44
  iconContent: `<g id="arrowAnnotate-group" fill="none" stroke-width="1" stroke="{{color}}" stroke-linecap="round" stroke-linejoin="round">
43
45
  <path id="arrowAnnotate-arrow" d="M23,7 l-15,15 M7,17 l0,6 6,0" stroke-width="2" />
44
46
  </g>`,
@@ -48,6 +50,7 @@ const CursorSVG = {
48
50
  },
49
51
  }),
50
52
  Bidirectional: extend(BASE, {
53
+ name: 'Bidirectional',
51
54
  iconContent: `<g fill="{{color}}" stroke-width="3" stroke="{{color}}">
52
55
  <path d="M27.63 3.21L3.12 28.81"></path>
53
56
  <path d="M27.63 15.75L15.27 4.43"></path>
@@ -62,6 +65,7 @@ const CursorSVG = {
62
65
  },
63
66
  }),
64
67
  CobbAngle: extend(BASE, {
68
+ name: 'CobbAngle',
65
69
  iconContent: `<g stroke="{{color}}" stroke-width="3">
66
70
  <path d="M28.59 2.34L3.82 12.32"></path>
67
71
  <path d="M28.59 29.66L3.82 19.68"></path>
@@ -76,6 +80,7 @@ const CursorSVG = {
76
80
  },
77
81
  }),
78
82
  CircleROI: extend(BASE, {
83
+ name: 'CircleROI',
79
84
  iconContent: `<circle stroke="{{color}}" fill="none" stroke-width="3" cx="16" cy="16" r="14" />`,
80
85
  viewBox: {
81
86
  x: 32,
@@ -83,6 +88,7 @@ const CursorSVG = {
83
88
  },
84
89
  }),
85
90
  EllipticalROI: extend(BASE, {
91
+ name: 'EllipticalROI',
86
92
  iconContent: `<path stroke="{{color}}" fill="none" stroke-width="3" d="M30.74 15.76C30.74 20.99 24.14 25.23 16
87
93
  25.23C7.86 25.23 1.26 20.99 1.26 15.76C1.26 10.54 7.86 6.3 16 6.3C24.14
88
94
  6.3 30.74 10.54 30.74 15.76Z" />`,
@@ -92,6 +98,7 @@ const CursorSVG = {
92
98
  },
93
99
  }),
94
100
  FreehandROI: extend(BASE, {
101
+ name: 'FreehandROI',
95
102
  iconContent: `<g fill="{{color}}" stroke="{{color}}" stroke-width="2">
96
103
  <ellipse ry="1" rx="1" id="svg_3" cy="4.240343" cx="14.306499"/>
97
104
  <line id="svg_4" y2="3.58462" x2="12.242186" y1="3.997482" x1="13.432202"/>
@@ -130,6 +137,7 @@ const CursorSVG = {
130
137
  },
131
138
  }),
132
139
  FreehandROISculptor: extend(BASE, {
140
+ name: 'FreehandROISculptor',
133
141
  iconContent: `<g id="icon-freehand-sculpt" fill="none" stroke-width="1.5" stroke="{{color}}" stroke-linecap="round" stroke-linejoin="round">
134
142
  <line id="svg_1" y2="2.559367" x2="10.184807" y1="4.467781" x1="8.81711"/>
135
143
  <line id="svg_4" y2="1.493836" x2="11.727442" y1="2.766112" x1="10.089386"/>
@@ -170,6 +178,7 @@ const CursorSVG = {
170
178
  },
171
179
  }),
172
180
  Length: extend(BASE, {
181
+ name: 'Length',
173
182
  iconContent: `<g id="length-group" fill="none" stroke-width="1" stroke="{{color}}" stroke-linecap="round" stroke-linejoin="round">
174
183
  <path id="length-dashes" d="m22.5,6 -16.5,16.5" stroke-width="3" stroke-dasharray="0.6666,5" />
175
184
  </g>`,
@@ -179,6 +188,7 @@ const CursorSVG = {
179
188
  },
180
189
  }),
181
190
  Height: extend(BASE, {
191
+ name: 'Height',
182
192
  iconContent: `<path d="m 6 22 l 8.5 0 v -16 h 8" stroke-width="3" fill="none" stroke="{{color}}" />`,
183
193
  viewBox: {
184
194
  x: 24,
@@ -186,6 +196,7 @@ const CursorSVG = {
186
196
  },
187
197
  }),
188
198
  Probe: extend(BASE, {
199
+ name: 'Probe',
189
200
  iconContent: `<path fill="{{color}}" d="M1152 896q0 106-75 181t-181 75-181-75-75-181 75-181 181-75 181 75
190
201
  75 181zm-256-544q-148 0-273 73t-198 198-73 273 73 273 198 198 273 73 273-73
191
202
  198-198 73-273-73-273-198-198-273-73zm768 544q0 209-103 385.5t-279.5
@@ -197,6 +208,7 @@ const CursorSVG = {
197
208
  },
198
209
  }),
199
210
  RectangleROI: extend(BASE, {
211
+ name: 'RectangleROI',
200
212
  iconContent: `<path fill="{{color}}" d="M1312 256h-832q-66 0-113 47t-47 113v832q0 66 47
201
213
  113t113 47h832q66 0 113-47t47-113v-832q0-66-47-113t-113-47zm288 160v832q0
202
214
  119-84.5 203.5t-203.5 84.5h-832q-119 0-203.5-84.5t-84.5-203.5v-832q0-119
@@ -207,6 +219,7 @@ const CursorSVG = {
207
219
  },
208
220
  }),
209
221
  TextMarker: extend(BASE, {
222
+ name: 'TextMarker',
210
223
  iconContent: `<path fill="{{color}}" d="M789 559l-170 450q33 0 136.5 2t160.5 2q19 0
211
224
  57-2-87-253-184-452zm-725 1105l2-79q23-7 56-12.5t57-10.5 49.5-14.5 44.5-29
212
225
  31-50.5l237-616 280-724h128q8 14 11 21l205 480q33 78 106 257.5t114 274.5q15
@@ -222,6 +235,7 @@ const CursorSVG = {
222
235
  },
223
236
  }),
224
237
  Crosshairs: extend(BASE, {
238
+ name: 'Crosshairs',
225
239
  iconContent: `<path fill="{{color}}" d="M1325 1024h-109q-26 0-45-19t-19-45v-128q0-26
226
240
  19-45t45-19h109q-32-108-112.5-188.5t-188.5-112.5v109q0 26-19 45t-45
227
241
  19h-128q-26 0-45-19t-19-45v-109q-108 32-188.5 112.5t-112.5 188.5h109q26
@@ -239,6 +253,7 @@ const CursorSVG = {
239
253
  },
240
254
  }),
241
255
  Eraser: extend(BASE, {
256
+ name: 'Eraser',
242
257
  iconContent: `<path transform="translate(0,1792) scale(1,-1)" fill="{{color}}" d="M960 1408l336-384h-768l-336 384h768zm1013-1077q15
243
258
  34 9.5 71.5t-30.5 65.5l-896 1024q-38 44-96 44h-768q-38
244
259
  0-69.5-20.5t-47.5-54.5q-15-34-9.5-71.5t30.5-65.5l896-1024q38-44 96-44h768q38
@@ -249,6 +264,7 @@ const CursorSVG = {
249
264
  },
250
265
  }),
251
266
  Magnify: extend(BASE, {
267
+ name: 'Magnify',
252
268
  iconContent: `<path fill="{{color}}" d="M508.5 481.6l-129-129c-2.3-2.3-5.3-3.5-8.5-3.5h-10.3C395
253
269
  312 416 262.5 416 208 416 93.1 322.9 0 208 0S0 93.1 0 208s93.1 208 208 208c54.5
254
270
  0 104-21 141.1-55.2V371c0 3.2 1.3 6.2 3.5 8.5l129 129c4.7 4.7 12.3 4.7 17
@@ -260,6 +276,7 @@ const CursorSVG = {
260
276
  },
261
277
  }),
262
278
  Pan: extend(BASE, {
279
+ name: 'Pan',
263
280
  iconContent: `<path fill="{{color}}" d="M1411 541l-355 355 355 355 144-144q29-31 70-14 39 17
264
281
  39 59v448q0 26-19 45t-45 19h-448q-42 0-59-40-17-39 14-69l144-144-355-355-355
265
282
  355 144 144q31 30 14 69-17 40-59 40h-448q-26 0-45-19t-19-45v-448q0-42 40-59
@@ -273,6 +290,7 @@ const CursorSVG = {
273
290
  },
274
291
  }),
275
292
  Rotate: extend(BASE, {
293
+ name: 'Rotate',
276
294
  iconContent: `<path fill="{{color}}" d="M1664 256v448q0 26-19 45t-45 19h-448q-42 0-59-40-17-39
277
295
  14-69l138-138q-148-137-349-137-104 0-198.5 40.5t-163.5 109.5-109.5
278
296
  163.5-40.5 198.5 40.5 198.5 109.5 163.5 163.5 109.5 198.5 40.5q119 0
@@ -286,6 +304,7 @@ const CursorSVG = {
286
304
  },
287
305
  }),
288
306
  StackScroll: extend(BASE, {
307
+ name: 'StackScroll',
289
308
  iconContent: `<path fill="{{color}}" d="M24 21v2c0 0.547-0.453 1-1 1h-22c-0.547
290
309
  0-1-0.453-1-1v-2c0-0.547 0.453-1 1-1h22c0.547 0 1 0.453 1 1zM24 13v2c0
291
310
  0.547-0.453 1-1 1h-22c-0.547 0-1-0.453-1-1v-2c0-0.547 0.453-1 1-1h22c0.547
@@ -297,6 +316,7 @@ const CursorSVG = {
297
316
  },
298
317
  }),
299
318
  WindowLevelRegion: extend(BASE, {
319
+ name: 'WindowLevelRegion',
300
320
  iconContent: `<path fill="{{color}}" d="M1664 416v960q0 119-84.5 203.5t-203.5 84.5h-960q-119
301
321
  0-203.5-84.5t-84.5-203.5v-960q0-119 84.5-203.5t203.5-84.5h960q119 0 203.5
302
322
  84.5t84.5 203.5z" />`,
@@ -306,6 +326,7 @@ const CursorSVG = {
306
326
  },
307
327
  }),
308
328
  WindowLevel: extend(BASE, {
329
+ name: 'WindowLevel',
309
330
  iconContent: `
310
331
  <path fill="{{color}}" d="M14.5,3.5 a1 1 0 0 1 -11,11 Z" stroke="none" opacity="0.8" />
311
332
  <circle cx="9" cy="9" r="8" fill="none" stroke-width="2" stroke="{{color}}" />`,
@@ -315,6 +336,7 @@ const CursorSVG = {
315
336
  },
316
337
  }),
317
338
  Zoom: extend(BASE, {
339
+ name: 'Zoom',
318
340
  iconContent: `
319
341
  <path fill="{{color}}" d="M508.5 481.6l-129-129c-2.3-2.3-5.3-3.5-8.5-3.5h-10.3C395
320
342
  312 416 262.5 416 208 416 93.1 322.9 0 208 0S0 93.1 0 208s93.1 208 208 208c54.5
@@ -331,64 +353,81 @@ const CursorSVG = {
331
353
  },
332
354
  }),
333
355
  SegmentationFreeHandEraseInside: extend(BASE, {
356
+ name: 'SegmentationFreeHandEraseInside',
334
357
  iconContent: `${SCISSOR_ICON} ${MINUS_RECT}`,
335
358
  viewBox: SEGMENTATION_CURSOR_BOUNDARIES,
336
359
  }),
337
360
  SegmentationFreeHandFillInside: extend(BASE, {
361
+ name: 'SegmentationFreeHandFillInside',
338
362
  iconContent: `${SCISSOR_ICON} ${PLUS_RECT}`,
339
363
  viewBox: SEGMENTATION_CURSOR_BOUNDARIES,
340
364
  }),
341
365
  SegmentationFreeHandEraseOutside: extend(BASE, {
366
+ name: 'SegmentationFreeHandEraseOutside',
342
367
  iconContent: `${SCISSOR_ICON} ${MINUS_RECT}`,
343
368
  viewBox: SEGMENTATION_CURSOR_BOUNDARIES,
344
369
  }),
345
370
  SegmentationFreeHandFillOutside: extend(BASE, {
371
+ name: 'SegmentationFreeHandFillOutside',
346
372
  iconContent: `${SCISSOR_ICON} ${PLUS_RECT}`,
347
373
  viewBox: SEGMENTATION_CURSOR_BOUNDARIES,
348
374
  }),
349
375
  SegmentationRectangleEraseInside: extend(BASE, {
376
+ name: 'SegmentationRectangleEraseInside',
350
377
  iconContent: `${RECTANGLE_ICON} ${MINUS_RECT}`,
351
378
  viewBox: SEGMENTATION_CURSOR_BOUNDARIES,
352
379
  }),
353
380
  RectangleScissor: extend(BASE, {
381
+ name: 'RectangleScissor',
354
382
  iconContent: `${RECTANGLE_ICON} ${PLUS_RECT}`,
355
383
  viewBox: SEGMENTATION_CURSOR_BOUNDARIES,
356
384
  }),
357
385
  'RectangleScissor.FILL_INSIDE': extend(BASE, {
386
+ name: 'RectangleScissor.FILL_INSIDE',
358
387
  iconContent: `${RECTANGLE_ICON} ${PLUS_RECT}`,
359
388
  viewBox: SEGMENTATION_CURSOR_BOUNDARIES,
360
389
  }),
361
390
  'RectangleScissor.FILL_OUTSIDE': extend(BASE, {
391
+ name: 'RectangleScissor.FILL_OUTSIDE',
362
392
  iconContent: `${RECTANGLE_ICON} ${PLUS_RECT}`,
363
393
  viewBox: SEGMENTATION_CURSOR_BOUNDARIES,
364
394
  }),
365
395
  'RectangleScissor.ERASE_OUTSIDE': extend(BASE, {
396
+ name: 'RectangleScissor.ERASE_OUTSIDE',
366
397
  iconContent: `${RECTANGLE_ICON} ${MINUS_RECT}`,
367
398
  viewBox: SEGMENTATION_CURSOR_BOUNDARIES,
368
399
  }),
369
400
  'RectangleScissor.ERASE_INSIDE': extend(BASE, {
401
+ name: 'RectangleScissor.ERASE_INSIDE',
370
402
  iconContent: `${RECTANGLE_ICON} ${MINUS_RECT}`,
371
403
  viewBox: SEGMENTATION_CURSOR_BOUNDARIES,
372
404
  }),
373
405
  CircleScissor: extend(BASE, {
406
+ name: 'CircleScissor',
374
407
  iconContent: `${CIRCLE_ICON} ${PLUS_RECT}`,
375
408
  viewBox: SEGMENTATION_CURSOR_BOUNDARIES,
376
409
  }),
377
410
  'CircleScissor.FILL_INSIDE': extend(BASE, {
411
+ name: 'CircleScissor.FILL_INSIDE',
378
412
  iconContent: `${CIRCLE_ICON} ${PLUS_RECT}`,
379
413
  viewBox: SEGMENTATION_CURSOR_BOUNDARIES,
380
414
  }),
381
415
  'CircleScissor.ERASE_OUTSIDE': extend(BASE, {
416
+ name: 'CircleScissor.ERASE_OUTSIDE',
382
417
  iconContent: `${CIRCLE_ICON} ${MINUS_RECT}`,
383
418
  viewBox: SEGMENTATION_CURSOR_BOUNDARIES,
384
419
  }),
385
420
  'CircleScissor.FILL_OUTSIDE': extend(BASE, {
421
+ name: 'CircleScissor.FILL_OUTSIDE',
386
422
  iconContent: `${CIRCLE_ICON} ${PLUS_RECT}`,
387
423
  viewBox: SEGMENTATION_CURSOR_BOUNDARIES,
388
424
  }),
389
425
  };
390
426
  function extend(base, values) {
391
- return Object.assign(Object.create(base), values);
427
+ return Object.assign(Object.create(base), {
428
+ ...values,
429
+ name: values.name || base.name,
430
+ });
392
431
  }
393
432
  function registerCursor(toolName, iconContent, viewBox) {
394
433
  CursorSVG[toolName] = extend(BASE, {
@@ -41,7 +41,10 @@ function createSVGMouseCursor(descriptor, name, pointer, color, fallback) {
41
41
  return new SVGMouseCursor(createSVGIconUrl(descriptor, pointer, { color }), x, y, name, fallback);
42
42
  }
43
43
  function createSVGIconUrl(descriptor, pointer, options) {
44
- return URL.createObjectURL(createSVGIconBlob(descriptor, pointer, options));
44
+ const blob = createSVGIconBlob(descriptor, pointer, options);
45
+ const url = URL.createObjectURL(blob);
46
+ const urn = `${url}#${descriptor.name || 'unknown'}-${pointer ? 'pointer' : 'cursor'}`;
47
+ return urn;
45
48
  }
46
49
  function createSVGIconBlob(descriptor, pointer, options) {
47
50
  const svgString = (pointer ? createSVGIconWithPointer : createSVGIcon)(descriptor, options);
@@ -3,7 +3,6 @@ import { ToolModes } from '../../enums';
3
3
  import filterToolsWithAnnotationsForElement from '../../store/filterToolsWithAnnotationsForElement';
4
4
  import getToolsWithModesForMouseEvent from '../shared/getToolsWithModesForMouseEvent';
5
5
  import triggerAnnotationRender from '../../utilities/triggerAnnotationRender';
6
- import { initElementCursor } from '../../cursors/elementCursor';
7
6
  const { Active, Passive } = ToolModes;
8
7
  export default function mouseMove(evt) {
9
8
  if (state.isInteractingWithTool || state.isMultiPartToolActive) {
@@ -35,7 +34,4 @@ export default function mouseMove(evt) {
35
34
  if (annotationsNeedToBeRedrawn === true) {
36
35
  triggerAnnotationRender(element);
37
36
  }
38
- if (!state.isInteractingWithTool) {
39
- initElementCursor(element, null);
40
- }
41
37
  }
@@ -3,9 +3,16 @@ export type SVGPoint = {
3
3
  y: number;
4
4
  };
5
5
  export type SVGCursorDescriptor = {
6
+ name?: string;
6
7
  iconContent: string;
7
- iconSize: number;
8
- viewBox: SVGPoint;
9
- mousePoint: SVGPoint;
10
- mousePointerGroupString: string;
8
+ iconSize?: number;
9
+ viewBox: {
10
+ x: number;
11
+ y: number;
12
+ };
13
+ mousePoint?: {
14
+ x: number;
15
+ y: number;
16
+ };
17
+ mousePointerGroupString?: string;
11
18
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cornerstonejs/tools",
3
- "version": "2.2.2",
3
+ "version": "2.2.3",
4
4
  "description": "Cornerstone3D Tools",
5
5
  "types": "./dist/esm/index.d.ts",
6
6
  "module": "./dist/esm/index.js",
@@ -104,7 +104,7 @@
104
104
  "canvas": "^2.11.2"
105
105
  },
106
106
  "peerDependencies": {
107
- "@cornerstonejs/core": "^2.2.2",
107
+ "@cornerstonejs/core": "^2.2.3",
108
108
  "@kitware/vtk.js": "32.1.0",
109
109
  "@types/d3-array": "^3.0.4",
110
110
  "@types/d3-interpolate": "^3.0.1",
@@ -123,5 +123,5 @@
123
123
  "type": "individual",
124
124
  "url": "https://ohif.org/donate"
125
125
  },
126
- "gitHead": "5eb6816e3ffd437d078bdba5832b10335f897184"
126
+ "gitHead": "43e6155d65db083b7d89161435d62a5968e5f56a"
127
127
  }