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 34 35 36 37 38 | 1x 120x 1x 96x 1x 4x | import { Enums, Types } from '@cornerstonejs/core';
import triggerAnnotationRender from '../utilities/triggerAnnotationRender';
/**
* When the image is rendered, check what tools can be rendered for this element.
*
* - First we get all tools which are active, passive or enabled on the element.
* - If any of these tools have a `renderAnnotation` method, then we render them.
* - Note that these tools don't necessarily have to be instances of `AnnotationTool`,
* Any tool may register a `renderAnnotation` method (e.g. a tool that displays an overlay).
*
* @param evt - The normalized IMAGE_RENDERED event.
*/
const onImageRendered = function (evt: Types.EventTypes.ImageRenderedEvent) {
// TODO: should we do this on camera modified instead of image rendered?
// e.g. no need to re-render annotations if only the VOI has changed
triggerAnnotationRender(evt.detail.element);
};
const enable = function (element: HTMLDivElement): void {
element.addEventListener(
Enums.Events.IMAGE_RENDERED,
onImageRendered as EventListener
);
};
const disable = function (element: HTMLDivElement): void {
element.removeEventListener(
Enums.Events.IMAGE_RENDERED,
onImageRendered as EventListener
);
};
export default {
enable,
disable,
};
|