All files / packages/tools/src/utilities getViewportForAnnotation.ts

100% Statements 2/2
50% Branches 1/2
100% Functions 1/1
100% Lines 2/2

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                          7x   7x    
import type { Annotation } from '../types';
import getViewportsForAnnotation from './getViewportsForAnnotation';
 
/**
 * Finds a matching viewport in terms of the orientation of the annotation data
 * and the frame of reference.  This doesn't mean the annotation IS being displayed
 * in the viewport, just that it could be by navigating the slice, and/or pan/zoom,
 * without changing the orientation.
 *
 * @param annotation - to find a viewport that it could display in
 * @returns The viewport to display in
 */
export default function getViewportForAnnotation(annotation: Annotation) {
  const viewports = getViewportsForAnnotation(annotation);
 
  return viewports.length ? viewports[0] : undefined;
}