@cornerstonejs/tools 5.3.0 → 5.4.1

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.
@@ -307,6 +307,9 @@ class CrosshairsTool extends AnnotationTool {
307
307
  this.resetCrosshairs();
308
308
  };
309
309
  this.mouseMoveCallback = (evt, filteredToolAnnotations) => {
310
+ if (!filteredToolAnnotations) {
311
+ return false;
312
+ }
310
313
  const { element, currentPoints } = evt.detail;
311
314
  const canvasCoords = currentPoints.canvas;
312
315
  let imageNeedsUpdate = false;
@@ -52,6 +52,7 @@ class SplineROITool extends ContourSegmentationBaseTool {
52
52
  configuration: {
53
53
  preventHandleOutsideImage: false,
54
54
  calculateStats: true,
55
+ allowOpenSplines: false,
55
56
  simplifiedSpline: false,
56
57
  getTextLines: defaultGetTextLines,
57
58
  contourHoleAdditionModifierKey: KeyboardBindings.Shift,
@@ -242,7 +243,9 @@ class SplineROITool extends ContourSegmentationBaseTool {
242
243
  const eventDetail = evt.detail;
243
244
  const { currentPoints, element } = eventDetail;
244
245
  const { canvas: canvasPoint, world: worldPoint } = currentPoints;
245
- let closeContour = data.handles.points.length >= 2 && doubleClick;
246
+ let closeContour = data.handles.points.length >= 2 &&
247
+ doubleClick &&
248
+ !this.configuration.allowOpenSplines;
246
249
  let addNewPoint = true;
247
250
  if (data.handles.points.length) {
248
251
  this.createMemo(element, annotation, {
@@ -255,7 +258,7 @@ class SplineROITool extends ContourSegmentationBaseTool {
255
258
  const closestControlPoint = spline.getClosestControlPointWithinDistance(canvasPoint, SPLINE_CLICK_CLOSE_CURVE_DIST);
256
259
  if (closestControlPoint?.index === 0) {
257
260
  addNewPoint = false;
258
- closeContour = true;
261
+ closeContour = !this.configuration.allowOpenSplines;
259
262
  }
260
263
  }
261
264
  if (addNewPoint) {
@@ -264,7 +267,10 @@ class SplineROITool extends ContourSegmentationBaseTool {
264
267
  data.contour.closed = data.contour.closed || closeContour;
265
268
  annotation.invalidated = true;
266
269
  triggerAnnotationRenderForViewportIds(viewportIdsToRender);
267
- if (data.contour.closed) {
270
+ const allowOpenSplines = doubleClick &&
271
+ this.configuration.allowOpenSplines &&
272
+ data.handles.points.length >= 3;
273
+ if (data.contour.closed || allowOpenSplines) {
268
274
  this._endCallback(evt);
269
275
  }
270
276
  evt.preventDefault();
@@ -1 +1 @@
1
- export declare const version = "5.3.0";
1
+ export declare const version = "5.4.1";
@@ -1 +1 @@
1
- export const version = '5.3.0';
1
+ export const version = '5.4.1';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cornerstonejs/tools",
3
- "version": "5.3.0",
3
+ "version": "5.4.1",
4
4
  "description": "Cornerstone3D Tools",
5
5
  "types": "./dist/esm/index.d.ts",
6
6
  "module": "./dist/esm/index.js",
@@ -126,11 +126,11 @@
126
126
  "lodash.get": "4.4.2"
127
127
  },
128
128
  "devDependencies": {
129
- "@cornerstonejs/core": "5.3.0",
129
+ "@cornerstonejs/core": "5.4.1",
130
130
  "canvas": "3.2.0"
131
131
  },
132
132
  "peerDependencies": {
133
- "@cornerstonejs/core": "5.3.0",
133
+ "@cornerstonejs/core": "5.4.1",
134
134
  "@kitware/vtk.js": "35.5.3",
135
135
  "@types/d3-array": "3.2.1",
136
136
  "@types/d3-interpolate": "3.0.4",
@@ -149,5 +149,5 @@
149
149
  "type": "individual",
150
150
  "url": "https://ohif.org/donate"
151
151
  },
152
- "gitHead": "6032c1e2640bcd18c7bd2bfb27181052b0e5d28e"
152
+ "gitHead": "2a6a97cfa5353f69116de006aa59f5d6e5624511"
153
153
  }