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

66.66% Statements 6/9
100% Branches 0/0
33.33% Functions 1/3
66.66% Lines 6/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        73x   73x         73x 72x         72x             72x    
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];
};