@cornerstonejs/tools 3.5.1 → 3.5.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.
@@ -218,8 +218,8 @@ const CursorSVG = {
218
218
  y: 1792,
219
219
  },
220
220
  }),
221
- TextMarker: extend(BASE, {
222
- name: 'TextMarker',
221
+ Label: extend(BASE, {
222
+ name: 'Label',
223
223
  iconContent: `<path fill="{{color}}" d="M789 559l-170 450q33 0 136.5 2t160.5 2q19 0
224
224
  57-2-87-253-184-452zm-725 1105l2-79q23-7 56-12.5t57-10.5 49.5-14.5 44.5-29
225
225
  31-50.5l237-616 280-724h128q8 14 11 21l205 480q33 78 106 257.5t114 274.5q15
@@ -3,7 +3,7 @@ import { AnnotationTool } from '../base';
3
3
  import type { EventTypes, PublicToolProps, ToolProps, SVGDrawingHelper, Annotation, InteractionTypes, ToolHandle } from '../../types';
4
4
  import type { LabelAnnotation } from '../../types/ToolSpecificAnnotationTypes';
5
5
  declare class LabelTool extends AnnotationTool {
6
- static toolName: any;
6
+ static toolName: string;
7
7
  editData: {
8
8
  annotation: Annotation;
9
9
  viewportIdsToRender: string[];
@@ -1,5 +1,5 @@
1
1
  import { vec2 } from 'gl-matrix';
2
- import { Events } from '../../enums';
2
+ import { ChangeTypes, Events } from '../../enums';
3
3
  import { getEnabledElement, utilities as csUtils, getEnabledElementByViewportId, } from '@cornerstonejs/core';
4
4
  import { AnnotationTool } from '../base';
5
5
  import { addAnnotation, getAnnotations, removeAnnotation, } from '../../stateManagement/annotation/annotationState';
@@ -10,6 +10,7 @@ import triggerAnnotationRenderForViewportIds from '../../utilities/triggerAnnota
10
10
  import { triggerAnnotationCompleted, triggerAnnotationModified, } from '../../stateManagement/annotation/helpers/state';
11
11
  import { resetElementCursor, hideElementCursor, } from '../../cursors/elementCursor';
12
12
  class LabelTool extends AnnotationTool {
13
+ static { this.toolName = 'Label'; }
13
14
  constructor(toolProps = {}, defaultToolProps = {
14
15
  supportedInteractionTypes: ['Mouse', 'Touch'],
15
16
  configuration: {
@@ -92,6 +93,12 @@ class LabelTool extends AnnotationTool {
92
93
  };
93
94
  addAnnotation(annotation, element);
94
95
  const viewportIdsToRender = getViewportIdsWithToolToRender(element, this.getToolName());
96
+ this.editData = {
97
+ annotation,
98
+ newAnnotation: true,
99
+ viewportIdsToRender,
100
+ offset: [0, 0, 0],
101
+ };
95
102
  evt.preventDefault();
96
103
  triggerAnnotationRenderForViewportIds(viewportIdsToRender);
97
104
  this.configuration.getTextCallback((text) => {
@@ -158,7 +165,7 @@ class LabelTool extends AnnotationTool {
158
165
  };
159
166
  this._dragCallback = (evt) => {
160
167
  const eventDetail = evt.detail;
161
- const { currentPoints } = eventDetail;
168
+ const { currentPoints, element } = eventDetail;
162
169
  const worldPos = currentPoints.world;
163
170
  const { annotation, viewportIdsToRender, offset } = this.editData;
164
171
  if (offset) {
@@ -173,6 +180,7 @@ class LabelTool extends AnnotationTool {
173
180
  }
174
181
  annotation.invalidated = true;
175
182
  triggerAnnotationRenderForViewportIds(viewportIdsToRender);
183
+ triggerAnnotationModified(annotation, element, ChangeTypes.LabelChange);
176
184
  };
177
185
  this.cancel = (element) => {
178
186
  if (this.isDrawing) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cornerstonejs/tools",
3
- "version": "3.5.1",
3
+ "version": "3.5.3",
4
4
  "description": "Cornerstone3D Tools",
5
5
  "types": "./dist/esm/index.d.ts",
6
6
  "module": "./dist/esm/index.js",
@@ -103,7 +103,7 @@
103
103
  "canvas": "^2.11.2"
104
104
  },
105
105
  "peerDependencies": {
106
- "@cornerstonejs/core": "^3.5.1",
106
+ "@cornerstonejs/core": "^3.5.3",
107
107
  "@kitware/vtk.js": "32.12.0",
108
108
  "@types/d3-array": "^3.0.4",
109
109
  "@types/d3-interpolate": "^3.0.1",
@@ -122,5 +122,5 @@
122
122
  "type": "individual",
123
123
  "url": "https://ohif.org/donate"
124
124
  },
125
- "gitHead": "49af3fa9bf7322b5f290a305c0232bbfac426b67"
125
+ "gitHead": "42ffdeabf1ed0bd2871db808bf198d5e3f4f4c94"
126
126
  }