feat: delete active annotation using backspace/delete key (#4722)

Co-authored-by: scouser <sharukh@Sharukhs-MacBook-Pro.local>
This commit is contained in:
Gas Giant 2025-01-24 19:12:00 +05:30 committed by GitHub
parent 01fa5d83a6
commit d6f0092a32
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 14 additions and 0 deletions

View File

@ -13,6 +13,7 @@ import {
ReferenceLinesTool, ReferenceLinesTool,
annotation, annotation,
} from '@cornerstonejs/tools'; } from '@cornerstonejs/tools';
import * as cornerstoneTools from '@cornerstonejs/tools';
import { Types as OhifTypes, utils } from '@ohif/core'; import { Types as OhifTypes, utils } from '@ohif/core';
import i18n from '@ohif/i18n'; import i18n from '@ohif/i18n';
@ -1298,6 +1299,12 @@ function commandsModule({
viewportGridService.getActiveViewportId() viewportGridService.getActiveViewportId()
); );
}, },
deleteActiveAnnotation: () => {
const activeAnnotationsUID = cornerstoneTools.annotation.selection.getAnnotationsSelected();
activeAnnotationsUID.forEach(activeAnnotationUID => {
measurementService.remove(activeAnnotationUID);
});
},
}; };
const definitions = { const definitions = {
@ -1558,6 +1565,9 @@ function commandsModule({
getRenderInactiveSegmentations: { getRenderInactiveSegmentations: {
commandFn: actions.getRenderInactiveSegmentations, commandFn: actions.getRenderInactiveSegmentations,
}, },
deleteActiveAnnotation: {
commandFn: actions.deleteActiveAnnotation,
},
}; };
return { return {

View File

@ -173,6 +173,10 @@ const bindings = [
label: 'W/L Preset 5', label: 'W/L Preset 5',
keys: ['5'], keys: ['5'],
}, },
{
commandName: 'deleteActiveAnnotation',
keys: ['backspace'],
},
// These don't exist, so don't try applying them.... // These don't exist, so don't try applying them....
// { // {
// commandName: 'setWindowLevel', // commandName: 'setWindowLevel',