@cornerstonejs/tools 0.59.1 → 0.60.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.
- 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/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/types/EventTypes.ts +21 -0
- package/src/utilities/scroll.ts +31 -2
|
@@ -151,6 +151,15 @@ declare type MouseWheelEventDetail = NormalizedInteractionEventDetail & MouseCus
|
|
|
151
151
|
};
|
|
152
152
|
points: IPoints;
|
|
153
153
|
};
|
|
154
|
+
declare type VolumeScrollOutOfBoundsEventDetail = {
|
|
155
|
+
volumeId: string;
|
|
156
|
+
viewport: Types.IVolumeViewport;
|
|
157
|
+
desiredStepIndex: number;
|
|
158
|
+
currentStepIndex: number;
|
|
159
|
+
delta: number;
|
|
160
|
+
numScrollSteps: number;
|
|
161
|
+
currentImageId: string;
|
|
162
|
+
};
|
|
154
163
|
declare type NormalizedMouseEventType = Types.CustomEventType<MouseCustomEventDetail>;
|
|
155
164
|
declare type NormalizedTouchEventType = Types.CustomEventType<TouchCustomEventDetail>;
|
|
156
165
|
declare type AnnotationAddedEventType = Types.CustomEventType<AnnotationAddedEventDetail>;
|
|
@@ -187,4 +196,5 @@ declare type MouseClickEventType = Types.CustomEventType<MouseClickEventDetail>;
|
|
|
187
196
|
declare type MouseMoveEventType = Types.CustomEventType<MouseMoveEventDetail>;
|
|
188
197
|
declare type MouseDoubleClickEventType = Types.CustomEventType<MouseDoubleClickEventDetail>;
|
|
189
198
|
declare type MouseWheelEventType = Types.CustomEventType<MouseWheelEventDetail>;
|
|
190
|
-
|
|
199
|
+
declare type VolumeScrollOutOfBoundsEventType = Types.CustomEventType<VolumeScrollOutOfBoundsEventDetail>;
|
|
200
|
+
export { InteractionStartType, InteractionEndType, InteractionEventType, NormalizedInteractionEventDetail, NormalizedMouseEventType, NormalizedTouchEventType, AnnotationAddedEventDetail, AnnotationAddedEventType, AnnotationCompletedEventDetail, AnnotationCompletedEventType, AnnotationModifiedEventDetail, AnnotationModifiedEventType, AnnotationRemovedEventDetail, AnnotationRemovedEventType, AnnotationSelectionChangeEventDetail, AnnotationSelectionChangeEventType, AnnotationRenderedEventDetail, AnnotationRenderedEventType, AnnotationLockChangeEventDetail, AnnotationVisibilityChangeEventDetail, AnnotationLockChangeEventType, AnnotationVisibilityChangeEventType, SegmentationDataModifiedEventType, SegmentationRepresentationModifiedEventDetail, SegmentationRepresentationModifiedEventType, SegmentationRepresentationRemovedEventDetail, SegmentationRepresentationRemovedEventType, SegmentationRemovedEventType, SegmentationRemovedEventDetail, SegmentationDataModifiedEventDetail, SegmentationRenderedEventType, SegmentationRenderedEventDetail, SegmentationModifiedEventType, SegmentationModifiedEventDetail, KeyDownEventDetail, KeyDownEventType, KeyUpEventDetail, KeyUpEventType, MouseDownEventDetail, TouchStartEventDetail, MouseDownEventType, TouchStartEventType, MouseDownActivateEventDetail, TouchStartActivateEventDetail, MouseDownActivateEventType, TouchStartActivateEventType, MouseDragEventDetail, TouchDragEventDetail, MouseDragEventType, TouchDragEventType, MouseUpEventDetail, TouchEndEventDetail, MouseUpEventType, TouchEndEventType, MouseClickEventDetail, MouseClickEventType, TouchTapEventDetail, TouchTapEventType, TouchSwipeEventDetail, TouchSwipeEventType, TouchPressEventDetail, TouchPressEventType, MouseMoveEventDetail, MouseMoveEventType, MouseDoubleClickEventDetail, MouseDoubleClickEventType, MouseWheelEventDetail, MouseWheelEventType, VolumeScrollOutOfBoundsEventDetail, VolumeScrollOutOfBoundsEventType, };
|
|
@@ -17,7 +17,7 @@ function scroll(viewport, options) {
|
|
|
17
17
|
}
|
|
18
18
|
exports.default = scroll;
|
|
19
19
|
function scrollVolume(viewport, volumeId, delta) {
|
|
20
|
-
const sliceRangeInfo = core_1.utilities.
|
|
20
|
+
const { numScrollSteps, currentStepIndex, sliceRangeInfo } = core_1.utilities.getVolumeViewportScrollInfo(viewport, volumeId);
|
|
21
21
|
if (!sliceRangeInfo) {
|
|
22
22
|
return;
|
|
23
23
|
}
|
|
@@ -29,6 +29,20 @@ function scrollVolume(viewport, volumeId, delta) {
|
|
|
29
29
|
position: newPosition,
|
|
30
30
|
});
|
|
31
31
|
viewport.render();
|
|
32
|
+
const desiredStepIndex = currentStepIndex + delta;
|
|
33
|
+
if ((desiredStepIndex > numScrollSteps || desiredStepIndex < 0) &&
|
|
34
|
+
viewport.getCurrentImageId()) {
|
|
35
|
+
const VolumeScrollEventDetail = {
|
|
36
|
+
volumeId,
|
|
37
|
+
viewport,
|
|
38
|
+
delta,
|
|
39
|
+
desiredStepIndex,
|
|
40
|
+
currentStepIndex,
|
|
41
|
+
numScrollSteps,
|
|
42
|
+
currentImageId: viewport.getCurrentImageId(),
|
|
43
|
+
};
|
|
44
|
+
core_1.utilities.triggerEvent(core_1.eventTarget, core_1.EVENTS.VOLUME_SCROLL_OUT_OF_BOUNDS, VolumeScrollEventDetail);
|
|
45
|
+
}
|
|
32
46
|
}
|
|
33
47
|
exports.scrollVolume = scrollVolume;
|
|
34
48
|
//# sourceMappingURL=scroll.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scroll.js","sourceRoot":"","sources":["../../../src/utilities/scroll.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"scroll.js","sourceRoot":"","sources":["../../../src/utilities/scroll.ts"],"names":[],"mappings":";;;AAAA,8CAO6B;AAY7B,SAAwB,MAAM,CAC5B,QAAsD,EACtD,OAAsB;IAEtB,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,GAAG,QAAQ,CAAC;IACxC,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,OAAO,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AQ;YACR,KAAK;YACL,gBAAgB;YAChB,gBAAgB;YAChB,cAAc;YACd,cAAc,EAAE,QAAQ,CAAC,iBAAiB,EAAE;SAC7C,CAAC;QAEF,gBAAO,CAAC,YAAY,CAClB,kBAAW,EACX,aAAM,CAAC,2BAA2B,EAClC,uBAAwE,CACzE,CAAC;KACH;AACH,CAAC;AAvDD,oCAuDC"}
|
|
@@ -151,6 +151,15 @@ declare type MouseWheelEventDetail = NormalizedInteractionEventDetail & MouseCus
|
|
|
151
151
|
};
|
|
152
152
|
points: IPoints;
|
|
153
153
|
};
|
|
154
|
+
declare type VolumeScrollOutOfBoundsEventDetail = {
|
|
155
|
+
volumeId: string;
|
|
156
|
+
viewport: Types.IVolumeViewport;
|
|
157
|
+
desiredStepIndex: number;
|
|
158
|
+
currentStepIndex: number;
|
|
159
|
+
delta: number;
|
|
160
|
+
numScrollSteps: number;
|
|
161
|
+
currentImageId: string;
|
|
162
|
+
};
|
|
154
163
|
declare type NormalizedMouseEventType = Types.CustomEventType<MouseCustomEventDetail>;
|
|
155
164
|
declare type NormalizedTouchEventType = Types.CustomEventType<TouchCustomEventDetail>;
|
|
156
165
|
declare type AnnotationAddedEventType = Types.CustomEventType<AnnotationAddedEventDetail>;
|
|
@@ -187,4 +196,5 @@ declare type MouseClickEventType = Types.CustomEventType<MouseClickEventDetail>;
|
|
|
187
196
|
declare type MouseMoveEventType = Types.CustomEventType<MouseMoveEventDetail>;
|
|
188
197
|
declare type MouseDoubleClickEventType = Types.CustomEventType<MouseDoubleClickEventDetail>;
|
|
189
198
|
declare type MouseWheelEventType = Types.CustomEventType<MouseWheelEventDetail>;
|
|
190
|
-
|
|
199
|
+
declare type VolumeScrollOutOfBoundsEventType = Types.CustomEventType<VolumeScrollOutOfBoundsEventDetail>;
|
|
200
|
+
export { InteractionStartType, InteractionEndType, InteractionEventType, NormalizedInteractionEventDetail, NormalizedMouseEventType, NormalizedTouchEventType, AnnotationAddedEventDetail, AnnotationAddedEventType, AnnotationCompletedEventDetail, AnnotationCompletedEventType, AnnotationModifiedEventDetail, AnnotationModifiedEventType, AnnotationRemovedEventDetail, AnnotationRemovedEventType, AnnotationSelectionChangeEventDetail, AnnotationSelectionChangeEventType, AnnotationRenderedEventDetail, AnnotationRenderedEventType, AnnotationLockChangeEventDetail, AnnotationVisibilityChangeEventDetail, AnnotationLockChangeEventType, AnnotationVisibilityChangeEventType, SegmentationDataModifiedEventType, SegmentationRepresentationModifiedEventDetail, SegmentationRepresentationModifiedEventType, SegmentationRepresentationRemovedEventDetail, SegmentationRepresentationRemovedEventType, SegmentationRemovedEventType, SegmentationRemovedEventDetail, SegmentationDataModifiedEventDetail, SegmentationRenderedEventType, SegmentationRenderedEventDetail, SegmentationModifiedEventType, SegmentationModifiedEventDetail, KeyDownEventDetail, KeyDownEventType, KeyUpEventDetail, KeyUpEventType, MouseDownEventDetail, TouchStartEventDetail, MouseDownEventType, TouchStartEventType, MouseDownActivateEventDetail, TouchStartActivateEventDetail, MouseDownActivateEventType, TouchStartActivateEventType, MouseDragEventDetail, TouchDragEventDetail, MouseDragEventType, TouchDragEventType, MouseUpEventDetail, TouchEndEventDetail, MouseUpEventType, TouchEndEventType, MouseClickEventDetail, MouseClickEventType, TouchTapEventDetail, TouchTapEventType, TouchSwipeEventDetail, TouchSwipeEventType, TouchPressEventDetail, TouchPressEventType, MouseMoveEventDetail, MouseMoveEventType, MouseDoubleClickEventDetail, MouseDoubleClickEventType, MouseWheelEventDetail, MouseWheelEventType, VolumeScrollOutOfBoundsEventDetail, VolumeScrollOutOfBoundsEventType, };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { StackViewport, VolumeViewport, utilities as csUtils, } from '@cornerstonejs/core';
|
|
1
|
+
import { StackViewport, VolumeViewport, eventTarget, EVENTS, utilities as csUtils, } from '@cornerstonejs/core';
|
|
2
2
|
export default function scroll(viewport, options) {
|
|
3
3
|
const { type: viewportType } = viewport;
|
|
4
4
|
const { volumeId, delta } = options;
|
|
@@ -13,7 +13,7 @@ export default function scroll(viewport, options) {
|
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
export function scrollVolume(viewport, volumeId, delta) {
|
|
16
|
-
const sliceRangeInfo = csUtils.
|
|
16
|
+
const { numScrollSteps, currentStepIndex, sliceRangeInfo } = csUtils.getVolumeViewportScrollInfo(viewport, volumeId);
|
|
17
17
|
if (!sliceRangeInfo) {
|
|
18
18
|
return;
|
|
19
19
|
}
|
|
@@ -25,5 +25,19 @@ export function scrollVolume(viewport, volumeId, delta) {
|
|
|
25
25
|
position: newPosition,
|
|
26
26
|
});
|
|
27
27
|
viewport.render();
|
|
28
|
+
const desiredStepIndex = currentStepIndex + delta;
|
|
29
|
+
if ((desiredStepIndex > numScrollSteps || desiredStepIndex < 0) &&
|
|
30
|
+
viewport.getCurrentImageId()) {
|
|
31
|
+
const VolumeScrollEventDetail = {
|
|
32
|
+
volumeId,
|
|
33
|
+
viewport,
|
|
34
|
+
delta,
|
|
35
|
+
desiredStepIndex,
|
|
36
|
+
currentStepIndex,
|
|
37
|
+
numScrollSteps,
|
|
38
|
+
currentImageId: viewport.getCurrentImageId(),
|
|
39
|
+
};
|
|
40
|
+
csUtils.triggerEvent(eventTarget, EVENTS.VOLUME_SCROLL_OUT_OF_BOUNDS, VolumeScrollEventDetail);
|
|
41
|
+
}
|
|
28
42
|
}
|
|
29
43
|
//# sourceMappingURL=scroll.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scroll.js","sourceRoot":"","sources":["../../../src/utilities/scroll.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EAEb,cAAc,EACd,SAAS,IAAI,OAAO,GACrB,MAAM,qBAAqB,CAAC;AAY7B,MAAM,CAAC,OAAO,UAAU,MAAM,CAC5B,QAAsD,EACtD,OAAsB;IAEtB,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,GAAG,QAAQ,CAAC;IACxC,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,G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