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 | 77x 77x 1x 76x 76x 76x 80x 76x | import { getRenderingEngines } from '@cornerstonejs/core';
import { triggerAnnotationRenderForViewportIds } from '../../utilities';
/**
* When an annotation is deselected, trigger an annotation render for all viewports.
* The reason for this is that, drawing an annotation in a different viewport
* should deselect all other annotations in other viewports. In order to achieve
* this, we need to trigger an annotation render for all viewports.
* Todo: Although this is inefficient, but since annotations are only rendered if necessary,
* it's probably not going to have a noticeable impact on performance.
* @param evt - The event object.
*/
function annotationSelectionListener(evt): void {
const deselectedAnnotation = evt.detail.removed;
if (!deselectedAnnotation.length) {
return;
}
const renderingEngines = getRenderingEngines();
renderingEngines.forEach((renderingEngine) => {
const viewports = renderingEngine.getViewports();
const viewportIds = viewports.map((vp) => vp.id);
triggerAnnotationRenderForViewportIds(renderingEngine, viewportIds);
});
}
export default annotationSelectionListener;
|