feat(hotkeys): Migrate hotkeys to customization service and fix issues with overrides (#4777)
This commit is contained in:
1 parent
4559d39a91
commit
3e6913b097
39 files changed
+814
-1552
No files matched your search
@@ -171,7 +171,6 @@ function modeFactory({ modeConfiguration }) {
|
||||
dicompdf.sopClassHandler,
|
||||
dicomsr.sopClassHandler,
|
||||
],
|
||||
hotkeys: [...hotkeys.defaults.hotkeyBindings],
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -102,6 +102,22 @@ function modeFactory() {
|
||||
'Crosshairs',
|
||||
'MoreTools',
|
||||
]);
|
||||
|
||||
customizationService.setCustomizations(
|
||||
{
|
||||
'ohif.hotkeyBindings': {
|
||||
$push: [
|
||||
{
|
||||
commandName: 'undo',
|
||||
label: 'Undo',
|
||||
keys: ['ctrl+z'],
|
||||
isEditable: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
'mode'
|
||||
);
|
||||
},
|
||||
onModeExit: ({ servicesManager }: withAppTypes) => {
|
||||
const {
|
||||
@@ -209,7 +225,6 @@ function modeFactory() {
|
||||
// Don't store the hotkeys for basic-test-mode under the same key
|
||||
// because they get customized by tests
|
||||
name: 'basic-test-hotkeys',
|
||||
hotkeys: [...hotkeys.defaults.hotkeyBindings],
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -84,7 +84,8 @@ function modeFactory({ modeConfiguration }) {
|
||||
* Lifecycle hooks
|
||||
*/
|
||||
onModeEnter: function ({ servicesManager, extensionManager, commandsManager }: withAppTypes) {
|
||||
const { measurementService, toolbarService, toolGroupService } = servicesManager.services;
|
||||
const { measurementService, toolbarService, toolGroupService, customizationService } =
|
||||
servicesManager.services;
|
||||
|
||||
measurementService.clearMeasurements();
|
||||
|
||||
@@ -238,7 +239,6 @@ function modeFactory({ modeConfiguration }) {
|
||||
dicomsr.sopClassHandler,
|
||||
dicomRT.sopClassHandler,
|
||||
],
|
||||
hotkeys: [...hotkeys.defaults.hotkeyBindings],
|
||||
...modeConfiguration,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -205,6 +205,32 @@ const toolbarButtons: Button[] = [
|
||||
},
|
||||
},
|
||||
},
|
||||
// {
|
||||
// id: 'Undo',
|
||||
// uiType: 'ohif.toolButton',
|
||||
// props: {
|
||||
// type: 'tool',
|
||||
// icon: 'prev-arrow',
|
||||
// label: 'Undo',
|
||||
// commands: {
|
||||
// commandName: 'undo',
|
||||
// },
|
||||
// evaluate: 'evaluate.action',
|
||||
// },
|
||||
// },
|
||||
// {
|
||||
// id: 'Redo',
|
||||
// uiType: 'ohif.toolButton',
|
||||
// props: {
|
||||
// type: 'tool',
|
||||
// icon: 'next-arrow',
|
||||
// label: 'Redo',
|
||||
// commands: {
|
||||
// commandName: 'redo',
|
||||
// },
|
||||
// evaluate: 'evaluate.action',
|
||||
// },
|
||||
// },
|
||||
];
|
||||
|
||||
export default toolbarButtons;
|
||||
@@ -123,7 +123,6 @@ function modeFactory({ modeConfiguration }) {
|
||||
dicomvideo.sopClassHandler,
|
||||
dicompdf.sopClassHandler,
|
||||
],
|
||||
hotkeys: [...hotkeys.defaults.hotkeyBindings],
|
||||
...modeConfiguration,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -167,7 +167,6 @@ function modeFactory({ modeConfiguration }) {
|
||||
// general handler needs to come last. For this case, the dicomvideo must
|
||||
// come first to remove video transfer syntax before ohif uses images
|
||||
sopClassHandlers: [ohif.chartSopClassHandler, ohif.defaultSopClassHandler],
|
||||
hotkeys: [...hotkeys.defaults.hotkeyBindings],
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { hotkeys } from '@ohif/core';
|
||||
import { id } from './id';
|
||||
import toolbarButtons from './toolbarButtons';
|
||||
import segmentationButtons from './segmentationButtons';
|
||||
@@ -49,7 +48,8 @@ function modeFactory({ modeConfiguration }) {
|
||||
* Services and other resources.
|
||||
*/
|
||||
onModeEnter: ({ servicesManager, extensionManager, commandsManager }: withAppTypes) => {
|
||||
const { measurementService, toolbarService, toolGroupService } = servicesManager.services;
|
||||
const { measurementService, toolbarService, toolGroupService, customizationService } =
|
||||
servicesManager.services;
|
||||
|
||||
measurementService.clearMeasurements();
|
||||
|
||||
@@ -158,8 +158,6 @@ function modeFactory({ modeConfiguration }) {
|
||||
// hangingProtocol: ['@ohif/mnGrid'],
|
||||
/** SopClassHandlers used by the mode */
|
||||
sopClassHandlers: [ohif.sopClassHandler, segmentation.sopClassHandler],
|
||||
/** hotkeys for mode */
|
||||
hotkeys: [...hotkeys.defaults.hotkeyBindings],
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -216,7 +216,6 @@ function modeFactory({ modeConfiguration }) {
|
||||
extensions: extensionDependencies,
|
||||
hangingProtocol: tmtv.hangingProtocol,
|
||||
sopClassHandlers: [ohif.sopClassHandler],
|
||||
hotkeys: [...hotkeys.defaults.hotkeyBindings],
|
||||
...modeConfiguration,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user