@cornerstonejs/tools 0.59.0 → 0.60.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.
- package/dist/cjs/tools/displayTools/Labelmap/labelmapDisplay.js +1 -1
- package/dist/cjs/tools/displayTools/Labelmap/labelmapDisplay.js.map +1 -1
- package/dist/cjs/types/EventTypes.d.ts +11 -1
- package/dist/cjs/utilities/scroll.js +15 -1
- package/dist/cjs/utilities/scroll.js.map +1 -1
- package/dist/esm/tools/displayTools/Labelmap/labelmapDisplay.js +1 -1
- package/dist/esm/tools/displayTools/Labelmap/labelmapDisplay.js.map +1 -1
- package/dist/esm/types/EventTypes.d.ts +11 -1
- package/dist/esm/utilities/scroll.js +16 -2
- package/dist/esm/utilities/scroll.js.map +1 -1
- package/dist/umd/index.js +1 -1
- package/dist/umd/index.js.map +1 -1
- package/package.json +3 -3
- package/src/tools/displayTools/Labelmap/labelmapDisplay.ts +1 -1
- package/src/types/EventTypes.ts +21 -0
- package/src/utilities/scroll.ts +31 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cornerstonejs/tools",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.60.0",
|
|
4
4
|
"description": "Cornerstone3D Tools",
|
|
5
5
|
"main": "dist/umd/index.js",
|
|
6
6
|
"types": "dist/esm/index.d.ts",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"webpack:watch": "webpack --mode development --progress --watch --config ./.webpack/webpack.dev.js"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@cornerstonejs/core": "^0.
|
|
29
|
+
"@cornerstonejs/core": "^0.39.0",
|
|
30
30
|
"lodash.clonedeep": "4.5.0",
|
|
31
31
|
"lodash.get": "^4.4.2"
|
|
32
32
|
},
|
|
@@ -52,5 +52,5 @@
|
|
|
52
52
|
"type": "individual",
|
|
53
53
|
"url": "https://ohif.org/donate"
|
|
54
54
|
},
|
|
55
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "efb03afb227a0628c3c056ca762bf061b632c55b"
|
|
56
56
|
}
|
package/src/types/EventTypes.ts
CHANGED
|
@@ -380,6 +380,19 @@ type MouseWheelEventDetail = NormalizedInteractionEventDetail &
|
|
|
380
380
|
points: IPoints;
|
|
381
381
|
};
|
|
382
382
|
|
|
383
|
+
/**
|
|
384
|
+
* Volume Scroll Out of Bounds event detail
|
|
385
|
+
*/
|
|
386
|
+
type VolumeScrollOutOfBoundsEventDetail = {
|
|
387
|
+
volumeId: string;
|
|
388
|
+
viewport: Types.IVolumeViewport;
|
|
389
|
+
desiredStepIndex: number;
|
|
390
|
+
currentStepIndex: number;
|
|
391
|
+
delta: number; // difference between the desired and current frame
|
|
392
|
+
numScrollSteps: number; // total scroll steps in the volume
|
|
393
|
+
currentImageId: string; // get ImageId (ImageIndex for in-plane acquisition)
|
|
394
|
+
};
|
|
395
|
+
|
|
383
396
|
/////////////////////////////
|
|
384
397
|
//
|
|
385
398
|
//
|
|
@@ -585,6 +598,12 @@ type MouseDoubleClickEventType =
|
|
|
585
598
|
*/
|
|
586
599
|
type MouseWheelEventType = Types.CustomEventType<MouseWheelEventDetail>;
|
|
587
600
|
|
|
601
|
+
/**
|
|
602
|
+
* Event for volume scroll out of bounds
|
|
603
|
+
*/
|
|
604
|
+
type VolumeScrollOutOfBoundsEventType =
|
|
605
|
+
Types.CustomEventType<VolumeScrollOutOfBoundsEventDetail>;
|
|
606
|
+
|
|
588
607
|
export {
|
|
589
608
|
InteractionStartType,
|
|
590
609
|
InteractionEndType,
|
|
@@ -654,4 +673,6 @@ export {
|
|
|
654
673
|
MouseDoubleClickEventType,
|
|
655
674
|
MouseWheelEventDetail,
|
|
656
675
|
MouseWheelEventType,
|
|
676
|
+
VolumeScrollOutOfBoundsEventDetail,
|
|
677
|
+
VolumeScrollOutOfBoundsEventType,
|
|
657
678
|
};
|
package/src/utilities/scroll.ts
CHANGED
|
@@ -2,9 +2,11 @@ import {
|
|
|
2
2
|
StackViewport,
|
|
3
3
|
Types,
|
|
4
4
|
VolumeViewport,
|
|
5
|
+
eventTarget,
|
|
6
|
+
EVENTS,
|
|
5
7
|
utilities as csUtils,
|
|
6
8
|
} from '@cornerstonejs/core';
|
|
7
|
-
import { ScrollOptions } from '../types';
|
|
9
|
+
import { ScrollOptions, EventTypes } from '../types';
|
|
8
10
|
|
|
9
11
|
/**
|
|
10
12
|
* It scrolls one slice in the Stack or Volume Viewport, it uses the options provided
|
|
@@ -36,7 +38,8 @@ export function scrollVolume(
|
|
|
36
38
|
volumeId: string,
|
|
37
39
|
delta: number
|
|
38
40
|
) {
|
|
39
|
-
const
|
|
41
|
+
const { numScrollSteps, currentStepIndex, sliceRangeInfo } =
|
|
42
|
+
csUtils.getVolumeViewportScrollInfo(viewport, volumeId);
|
|
40
43
|
|
|
41
44
|
if (!sliceRangeInfo) {
|
|
42
45
|
return;
|
|
@@ -59,4 +62,30 @@ export function scrollVolume(
|
|
|
59
62
|
position: newPosition,
|
|
60
63
|
});
|
|
61
64
|
viewport.render();
|
|
65
|
+
|
|
66
|
+
const desiredStepIndex = currentStepIndex + delta;
|
|
67
|
+
|
|
68
|
+
if (
|
|
69
|
+
(desiredStepIndex > numScrollSteps || desiredStepIndex < 0) &&
|
|
70
|
+
viewport.getCurrentImageId() // Check that we are in the plane of acquistion
|
|
71
|
+
) {
|
|
72
|
+
// One common use case of this trigger might be to load the next
|
|
73
|
+
// volume in a time series or the next segment of a partially loaded volume.
|
|
74
|
+
|
|
75
|
+
const VolumeScrollEventDetail = {
|
|
76
|
+
volumeId,
|
|
77
|
+
viewport,
|
|
78
|
+
delta,
|
|
79
|
+
desiredStepIndex,
|
|
80
|
+
currentStepIndex,
|
|
81
|
+
numScrollSteps,
|
|
82
|
+
currentImageId: viewport.getCurrentImageId(),
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
csUtils.triggerEvent(
|
|
86
|
+
eventTarget,
|
|
87
|
+
EVENTS.VOLUME_SCROLL_OUT_OF_BOUNDS,
|
|
88
|
+
VolumeScrollEventDetail as EventTypes.VolumeScrollOutOfBoundsEventDetail
|
|
89
|
+
);
|
|
90
|
+
}
|
|
62
91
|
}
|