All files / extensions/cornerstone/src/utils setUpAnnotationEventHandlers.ts

77.77% Statements 7/9
100% Branches 0/0
66.66% Functions 2/3
77.77% Lines 7/9

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27        204x   204x         204x 204x         204x 12x           204x    
import * as csTools from '@cornerstonejs/tools';
 
import { eventTarget } from '@cornerstonejs/core';
 
const { Enums: csToolsEnums } = csTools;
 
const _autoAcceptAnnotationInterpolationHandler = evt => {
  const { element } = evt.detail;
  csTools.utilities.contours.acceptAutogeneratedInterpolations(element, {});
};
 
export const setUpAnnotationEventHandlers = (): [() => void] => {
  eventTarget.addEventListener(
    csToolsEnums.Events.ANNOTATION_INTERPOLATION_PROCESS_COMPLETED,
    _autoAcceptAnnotationInterpolationHandler
  );
 
  const annotationInterpolationProcessCompletedUnsubscribe = () => {
    eventTarget.removeEventListener(
      csToolsEnums.Events.ANNOTATION_INTERPOLATION_PROCESS_COMPLETED,
      _autoAcceptAnnotationInterpolationHandler
    );
  };
 
  return [annotationInterpolationProcessCompletedUnsubscribe];
};