All files / tools/src/stateManagement/annotation resetAnnotationManager.ts

92.3% Statements 12/13
100% Branches 0/0
50% Functions 1/2
92.3% Lines 12/13

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 28 29 30 31 32 33                    428x 428x 164x 164x   164x 164x 164x   164x 164x   164x     428x 428x            
import type { Annotation } from '../../types';
import {
  checkAndDefineCachedStatsProperty,
  checkAndDefineTextBoxProperty,
} from './utilities/defineProperties';
import { checkAndSetAnnotationLocked } from './annotationLocking';
import { checkAndSetAnnotationVisibility } from './annotationVisibility';
import { defaultFrameOfReferenceSpecificAnnotationManager } from './FrameOfReferenceSpecificAnnotationManager';
import { setAnnotationManager } from './annotationState';
 
const defaultManager = defaultFrameOfReferenceSpecificAnnotationManager;
const preprocessingFn = (annotation: Annotation) => {
  annotation = checkAndDefineTextBoxProperty(annotation);
  annotation = checkAndDefineCachedStatsProperty(annotation);
 
  const uid = annotation.annotationUID;
  const isLocked = checkAndSetAnnotationLocked(uid);
  annotation.isLocked = isLocked;
 
  const isVisible = checkAndSetAnnotationVisibility(uid);
  annotation.isVisible = isVisible;
 
  return annotation;
};
 
defaultManager.setPreprocessingFn(preprocessingFn);
setAnnotationManager(defaultManager);
 
// set back to default frameOfReferenceSpecificAnnotationManager
export function resetAnnotationManager() {
  setAnnotationManager(defaultManager);
}