Implementing saving behavior per active viewport
This commit is contained in:
1 parent
98480d134b
commit
5dc2f8dc9c
13 files changed
+66
-15
No files matched your search
@@ -21,7 +21,7 @@ Meteor.startup(() => {
|
||||
name: 'UN Target'
|
||||
}];
|
||||
customTools.forEach(tool => {
|
||||
_.defaults(OHIF.hotkeys.defaults.viewer, { [tool.id]: '' });
|
||||
_.defaults(OHIF.hotkeys.defaults[contextName], { [tool.id]: '' });
|
||||
OHIF.commands.register(contextName, tool.id, {
|
||||
name: tool.name,
|
||||
action: tool.action || (() => toolManager.setActiveTool(tool.id))
|
||||
@@ -35,10 +35,36 @@ Meteor.startup(() => {
|
||||
action: OHIF.viewerbase.viewportUtils.linkStackScroll
|
||||
}];
|
||||
customCommands.forEach(command => {
|
||||
_.defaults(OHIF.hotkeys.defaults.viewer, { [command.id]: '' });
|
||||
_.defaults(OHIF.hotkeys.defaults[contextName], { [command.id]: '' });
|
||||
OHIF.commands.register(contextName, command.id, {
|
||||
name: command.name,
|
||||
action: command.action || (() => toolManager.setActiveTool(command.id))
|
||||
});
|
||||
});
|
||||
|
||||
// Add the save command
|
||||
OHIF.commands.register(contextName, 'storeMeasurements', () => {
|
||||
// Register the hotkey default
|
||||
_.defaults(OHIF.hotkeys.defaults[contextName], { storeMeasurements: '' });
|
||||
|
||||
// Clear signaled unsaved changes...
|
||||
const successHandler = () => {
|
||||
OHIF.ui.unsavedChanges.clear(`${instance.path}.*`);
|
||||
instance.saveObserver.changed();
|
||||
};
|
||||
|
||||
// Display the error messages
|
||||
const errorHandler = data => {
|
||||
OHIF.ui.showDialog('dialogInfo', Object.assign({ class: 'themed' }, data));
|
||||
};
|
||||
|
||||
const promise = OHIF.viewer.measurementApi.storeMeasurements();
|
||||
promise.then(successHandler).catch(errorHandler);
|
||||
OHIF.ui.showDialog('dialogLoading', {
|
||||
promise,
|
||||
text: 'Saving measurement data'
|
||||
});
|
||||
|
||||
return promise;
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user