@cornerstonejs/tools 3.12.3 → 3.14.0

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.
@@ -3,6 +3,7 @@ import { addTool, removeTool, ToolGroupManager, SynchronizerManager, Synchronize
3
3
  import { state } from './store/state';
4
4
  import * as store from './store';
5
5
  import * as CONSTANTS from './constants';
6
+ import { version } from './version';
6
7
  import * as synchronizers from './synchronizers';
7
8
  import * as drawing from './drawingSvg';
8
9
  import * as utilities from './utilities';
@@ -14,4 +15,4 @@ import * as splines from './tools/annotation/splines';
14
15
  import { BaseTool, AnnotationTool, AnnotationDisplayTool, PanTool, TrackballRotateTool, DragProbeTool, WindowLevelTool, ZoomTool, StackScrollTool, SegmentBidirectionalTool, PlanarRotateTool, MIPJumpToClickTool, LabelTool, LengthTool, HeightTool, ProbeTool, RectangleROITool, EllipticalROITool, CircleROITool, ETDRSGridTool, SplineROITool, SplineContourSegmentationTool, BidirectionalTool, PlanarFreehandROITool, PlanarFreehandContourSegmentationTool, LivewireContourTool, LivewireContourSegmentationTool, ArrowAnnotateTool, KeyImageTool, CrosshairsTool, ReferenceLinesTool, RectangleScissorsTool, CircleScissorsTool, SphereScissorsTool, RectangleROIThresholdTool, RectangleROIStartEndThresholdTool, CircleROIStartEndThresholdTool, BrushTool, AngleTool, CobbAngleTool, UltrasoundDirectionalTool, MagnifyTool, AdvancedMagnifyTool, ReferenceCursors, PaintFillTool, ScaleOverlayTool, OrientationMarkerTool, OverlayGridTool, SegmentationIntersectionTool, EraserTool, SculptorTool, SegmentSelectTool, WindowLevelRegionTool, VolumeRotateTool, RegionSegmentPlusTool, RegionSegmentTool, WholeBodySegmentTool, LabelmapBaseTool, SegmentLabelTool } from './tools';
15
16
  import VideoRedactionTool from './tools/annotation/VideoRedactionTool';
16
17
  import * as Enums from './enums';
17
- export { VideoRedactionTool, init, destroy, addTool, removeTool, cancelActiveManipulations, BaseTool, AnnotationTool, AnnotationDisplayTool, PanTool, SegmentBidirectionalTool, TrackballRotateTool, DragProbeTool, WindowLevelTool, WindowLevelRegionTool, ZoomTool, StackScrollTool, PlanarRotateTool, MIPJumpToClickTool, LabelTool, LengthTool, HeightTool, CrosshairsTool, ReferenceLinesTool, OverlayGridTool, SegmentationIntersectionTool, ProbeTool, RectangleROITool, EllipticalROITool, CircleROITool, ETDRSGridTool, SplineROITool, SplineContourSegmentationTool, BidirectionalTool, PlanarFreehandROITool, PlanarFreehandContourSegmentationTool, LivewireContourTool, LivewireContourSegmentationTool, ArrowAnnotateTool, AngleTool, CobbAngleTool, UltrasoundDirectionalTool, KeyImageTool, MagnifyTool, AdvancedMagnifyTool, ReferenceCursors, ScaleOverlayTool, SculptorTool, EraserTool, RectangleScissorsTool, CircleScissorsTool, SphereScissorsTool, RectangleROIThresholdTool, RectangleROIStartEndThresholdTool, CircleROIStartEndThresholdTool, BrushTool, OrientationMarkerTool, SegmentSelectTool, SegmentLabelTool, synchronizers, Synchronizer, SynchronizerManager, PaintFillTool, Types, state, ToolGroupManager, store, Enums, CONSTANTS, drawing, annotation, segmentation, utilities, cursors, VolumeRotateTool, RegionSegmentPlusTool, RegionSegmentTool, WholeBodySegmentTool, LabelmapBaseTool, splines, };
18
+ export { VideoRedactionTool, init, destroy, addTool, removeTool, cancelActiveManipulations, BaseTool, AnnotationTool, AnnotationDisplayTool, PanTool, SegmentBidirectionalTool, TrackballRotateTool, DragProbeTool, WindowLevelTool, WindowLevelRegionTool, ZoomTool, StackScrollTool, PlanarRotateTool, MIPJumpToClickTool, LabelTool, LengthTool, HeightTool, CrosshairsTool, ReferenceLinesTool, OverlayGridTool, SegmentationIntersectionTool, ProbeTool, RectangleROITool, EllipticalROITool, CircleROITool, ETDRSGridTool, SplineROITool, SplineContourSegmentationTool, BidirectionalTool, PlanarFreehandROITool, PlanarFreehandContourSegmentationTool, LivewireContourTool, LivewireContourSegmentationTool, ArrowAnnotateTool, AngleTool, CobbAngleTool, UltrasoundDirectionalTool, KeyImageTool, MagnifyTool, AdvancedMagnifyTool, ReferenceCursors, ScaleOverlayTool, SculptorTool, EraserTool, RectangleScissorsTool, CircleScissorsTool, SphereScissorsTool, RectangleROIThresholdTool, RectangleROIStartEndThresholdTool, CircleROIStartEndThresholdTool, BrushTool, OrientationMarkerTool, SegmentSelectTool, SegmentLabelTool, synchronizers, Synchronizer, SynchronizerManager, PaintFillTool, Types, state, ToolGroupManager, store, Enums, CONSTANTS, drawing, annotation, segmentation, utilities, cursors, VolumeRotateTool, RegionSegmentPlusTool, RegionSegmentTool, WholeBodySegmentTool, LabelmapBaseTool, splines, version, };
package/dist/esm/index.js CHANGED
@@ -3,6 +3,7 @@ import { addTool, removeTool, ToolGroupManager, SynchronizerManager, Synchronize
3
3
  import { state } from './store/state';
4
4
  import * as store from './store';
5
5
  import * as CONSTANTS from './constants';
6
+ import { version } from './version';
6
7
  import * as synchronizers from './synchronizers';
7
8
  import * as drawing from './drawingSvg';
8
9
  import * as utilities from './utilities';
@@ -14,4 +15,4 @@ import * as splines from './tools/annotation/splines';
14
15
  import { BaseTool, AnnotationTool, AnnotationDisplayTool, PanTool, TrackballRotateTool, DragProbeTool, WindowLevelTool, ZoomTool, StackScrollTool, SegmentBidirectionalTool, PlanarRotateTool, MIPJumpToClickTool, LabelTool, LengthTool, HeightTool, ProbeTool, RectangleROITool, EllipticalROITool, CircleROITool, ETDRSGridTool, SplineROITool, SplineContourSegmentationTool, BidirectionalTool, PlanarFreehandROITool, PlanarFreehandContourSegmentationTool, LivewireContourTool, LivewireContourSegmentationTool, ArrowAnnotateTool, KeyImageTool, CrosshairsTool, ReferenceLinesTool, RectangleScissorsTool, CircleScissorsTool, SphereScissorsTool, RectangleROIThresholdTool, RectangleROIStartEndThresholdTool, CircleROIStartEndThresholdTool, BrushTool, AngleTool, CobbAngleTool, UltrasoundDirectionalTool, MagnifyTool, AdvancedMagnifyTool, ReferenceCursors, PaintFillTool, ScaleOverlayTool, OrientationMarkerTool, OverlayGridTool, SegmentationIntersectionTool, EraserTool, SculptorTool, SegmentSelectTool, WindowLevelRegionTool, VolumeRotateTool, RegionSegmentPlusTool, RegionSegmentTool, WholeBodySegmentTool, LabelmapBaseTool, SegmentLabelTool, } from './tools';
15
16
  import VideoRedactionTool from './tools/annotation/VideoRedactionTool';
16
17
  import * as Enums from './enums';
17
- export { VideoRedactionTool, init, destroy, addTool, removeTool, cancelActiveManipulations, BaseTool, AnnotationTool, AnnotationDisplayTool, PanTool, SegmentBidirectionalTool, TrackballRotateTool, DragProbeTool, WindowLevelTool, WindowLevelRegionTool, ZoomTool, StackScrollTool, PlanarRotateTool, MIPJumpToClickTool, LabelTool, LengthTool, HeightTool, CrosshairsTool, ReferenceLinesTool, OverlayGridTool, SegmentationIntersectionTool, ProbeTool, RectangleROITool, EllipticalROITool, CircleROITool, ETDRSGridTool, SplineROITool, SplineContourSegmentationTool, BidirectionalTool, PlanarFreehandROITool, PlanarFreehandContourSegmentationTool, LivewireContourTool, LivewireContourSegmentationTool, ArrowAnnotateTool, AngleTool, CobbAngleTool, UltrasoundDirectionalTool, KeyImageTool, MagnifyTool, AdvancedMagnifyTool, ReferenceCursors, ScaleOverlayTool, SculptorTool, EraserTool, RectangleScissorsTool, CircleScissorsTool, SphereScissorsTool, RectangleROIThresholdTool, RectangleROIStartEndThresholdTool, CircleROIStartEndThresholdTool, BrushTool, OrientationMarkerTool, SegmentSelectTool, SegmentLabelTool, synchronizers, Synchronizer, SynchronizerManager, PaintFillTool, Types, state, ToolGroupManager, store, Enums, CONSTANTS, drawing, annotation, segmentation, utilities, cursors, VolumeRotateTool, RegionSegmentPlusTool, RegionSegmentTool, WholeBodySegmentTool, LabelmapBaseTool, splines, };
18
+ export { VideoRedactionTool, init, destroy, addTool, removeTool, cancelActiveManipulations, BaseTool, AnnotationTool, AnnotationDisplayTool, PanTool, SegmentBidirectionalTool, TrackballRotateTool, DragProbeTool, WindowLevelTool, WindowLevelRegionTool, ZoomTool, StackScrollTool, PlanarRotateTool, MIPJumpToClickTool, LabelTool, LengthTool, HeightTool, CrosshairsTool, ReferenceLinesTool, OverlayGridTool, SegmentationIntersectionTool, ProbeTool, RectangleROITool, EllipticalROITool, CircleROITool, ETDRSGridTool, SplineROITool, SplineContourSegmentationTool, BidirectionalTool, PlanarFreehandROITool, PlanarFreehandContourSegmentationTool, LivewireContourTool, LivewireContourSegmentationTool, ArrowAnnotateTool, AngleTool, CobbAngleTool, UltrasoundDirectionalTool, KeyImageTool, MagnifyTool, AdvancedMagnifyTool, ReferenceCursors, ScaleOverlayTool, SculptorTool, EraserTool, RectangleScissorsTool, CircleScissorsTool, SphereScissorsTool, RectangleROIThresholdTool, RectangleROIStartEndThresholdTool, CircleROIStartEndThresholdTool, BrushTool, OrientationMarkerTool, SegmentSelectTool, SegmentLabelTool, synchronizers, Synchronizer, SynchronizerManager, PaintFillTool, Types, state, ToolGroupManager, store, Enums, CONSTANTS, drawing, annotation, segmentation, utilities, cursors, VolumeRotateTool, RegionSegmentPlusTool, RegionSegmentTool, WholeBodySegmentTool, LabelmapBaseTool, splines, version, };
@@ -1,11 +1,12 @@
1
1
  type PlayClipOptions = {
2
2
  framesPerSecond?: number;
3
3
  frameTimeVector?: number[];
4
+ frameTimeVectorSpeedMultiplier?: number;
4
5
  reverse?: boolean;
5
6
  loop?: boolean;
6
7
  dynamicCineEnabled?: boolean;
7
- frameTimeVectorSpeedMultiplier?: number;
8
8
  waitForRendered?: number;
9
+ bounce?: boolean;
9
10
  };
10
11
  interface ToolData {
11
12
  intervalId: number | undefined;
@@ -17,6 +18,7 @@ interface ToolData {
17
18
  speed: number;
18
19
  reverse: boolean;
19
20
  loop: boolean;
21
+ bounce: boolean;
20
22
  dynamicCineEnabled?: boolean;
21
23
  }
22
24
  type CinePlayContext = {
@@ -39,6 +39,7 @@ function playClip(element, playClipOptions) {
39
39
  speed: playClipOptions.frameTimeVectorSpeedMultiplier ?? 1,
40
40
  reverse: playClipOptions.reverse ?? false,
41
41
  loop: playClipOptions.loop ?? true,
42
+ bounce: playClipOptions.bounce ?? false,
42
43
  };
43
44
  addToolState(element, playClipData);
44
45
  }
@@ -63,24 +64,30 @@ function playClip(element, playClipOptions) {
63
64
  playClipTimeouts = timeouts;
64
65
  playClipIsTimeVarying = isTimeVarying;
65
66
  }
67
+ if (playClipOptions.bounce !== undefined) {
68
+ playClipData.bounce = playClipOptions.bounce;
69
+ }
66
70
  const playClipAction = () => {
67
71
  const { numScrollSteps, currentStepIndex } = playClipContext;
68
72
  let newStepIndex = currentStepIndex + (playClipData.reverse ? -1 : 1);
69
- const newStepIndexOutOfRange = newStepIndex < 0 || newStepIndex >= numScrollSteps;
70
- if (!playClipData.loop && newStepIndexOutOfRange) {
71
- _stopClip(element, {
72
- stopDynamicCine: !isDynamicCinePlaying,
73
- viewportId: viewport.id,
74
- });
75
- const eventDetail = { element };
76
- triggerEvent(element, CINE_EVENTS.CLIP_STOPPED, eventDetail);
77
- return;
78
- }
79
- if (newStepIndex >= numScrollSteps) {
80
- newStepIndex = 0;
81
- }
82
- else if (newStepIndex < 0) {
83
- newStepIndex = numScrollSteps - 1;
73
+ const outOfRange = newStepIndex < 0 || newStepIndex >= numScrollSteps;
74
+ if (outOfRange) {
75
+ if (playClipData.bounce) {
76
+ playClipData.reverse = !playClipData.reverse;
77
+ newStepIndex = currentStepIndex + (playClipData.reverse ? -1 : 1);
78
+ newStepIndex = Math.max(0, Math.min(numScrollSteps - 1, newStepIndex));
79
+ }
80
+ else if (!playClipData.loop) {
81
+ _stopClip(element, {
82
+ stopDynamicCine: !isDynamicCinePlaying,
83
+ viewportId: viewport.id,
84
+ });
85
+ triggerEvent(element, CINE_EVENTS.CLIP_STOPPED, { element });
86
+ return;
87
+ }
88
+ else {
89
+ newStepIndex = playClipData.reverse ? numScrollSteps - 1 : 0;
90
+ }
84
91
  }
85
92
  const delta = newStepIndex - currentStepIndex;
86
93
  if (delta) {
@@ -90,8 +97,7 @@ function playClip(element, playClipOptions) {
90
97
  catch (e) {
91
98
  console.warn('Play clip not scrolling', e);
92
99
  _stopClipWithData(playClipData);
93
- triggerEvent(element, CINE_EVENTS.CLIP_STOPPED, eventDetail);
94
- return;
100
+ triggerEvent(element, CINE_EVENTS.CLIP_STOPPED, { element });
95
101
  }
96
102
  }
97
103
  };
@@ -0,0 +1 @@
1
+ export declare const version = "3.14.0";
@@ -0,0 +1 @@
1
+ export const version = '3.14.0';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cornerstonejs/tools",
3
- "version": "3.12.3",
3
+ "version": "3.14.0",
4
4
  "description": "Cornerstone3D Tools",
5
5
  "types": "./dist/esm/index.d.ts",
6
6
  "module": "./dist/esm/index.js",
@@ -78,9 +78,14 @@
78
78
  },
79
79
  "./types/*": {
80
80
  "types": "./dist/esm/types/*.d.ts"
81
+ },
82
+ "./version": {
83
+ "import": "./dist/esm/version.js",
84
+ "types": "./dist/esm/version.d.ts"
81
85
  }
82
86
  },
83
87
  "scripts": {
88
+ "prebuild": "node ../../scripts/generate-version.js ./",
84
89
  "build:esm": "tsc --project ./tsconfig.json",
85
90
  "build:esm:watch": "tsc --project ./tsconfig.json --watch",
86
91
  "build:umd": "cross-env NODE_ENV=production webpack --config .webpack/webpack.prod.js",
@@ -103,7 +108,7 @@
103
108
  "canvas": "^3.1.0"
104
109
  },
105
110
  "peerDependencies": {
106
- "@cornerstonejs/core": "^3.12.3",
111
+ "@cornerstonejs/core": "^3.14.0",
107
112
  "@kitware/vtk.js": "32.12.1",
108
113
  "@types/d3-array": "^3.0.4",
109
114
  "@types/d3-interpolate": "^3.0.1",
@@ -122,5 +127,5 @@
122
127
  "type": "individual",
123
128
  "url": "https://ohif.org/donate"
124
129
  },
125
- "gitHead": "bbebfa9b1df39b562dd4e1cf3e94ed0a496f2324"
130
+ "gitHead": "77cb34ca2e17c506bf6376f40bdf6cb934e176e3"
126
131
  }