OHIF-223: Add "Clear" all measurements to annotation toolbar (#1861)
* Add clear button * Use james event * Create new commands module to default
This commit is contained in:
1 parent
61fc093fc5
commit
11fbe4cf01
13 files changed
+112
-7
No files matched your search
@@ -23,9 +23,10 @@ export default function PanelMeasurementTable({
|
||||
const added = MeasurementService.EVENTS.MEASUREMENT_ADDED;
|
||||
const updated = MeasurementService.EVENTS.MEASUREMENT_UPDATED;
|
||||
const removed = MeasurementService.EVENTS.MEASUREMENT_REMOVED;
|
||||
const cleared = MeasurementService.EVENTS.MEASUREMENTS_CLEARED;
|
||||
const subscriptions = [];
|
||||
|
||||
[added, updated, removed].forEach(evt => {
|
||||
[added, updated, removed, cleared].forEach(evt => {
|
||||
subscriptions.push(
|
||||
MeasurementService.subscribe(evt, () => {
|
||||
debouncedSetDisplayMeasurements(
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
const commandsModule = ({ servicesManager }) => {
|
||||
const { MeasurementService } = servicesManager.services;
|
||||
|
||||
const actions = {
|
||||
clearMeasurements: () => {
|
||||
MeasurementService.clear();
|
||||
},
|
||||
};
|
||||
|
||||
const definitions = {
|
||||
clearMeasurements: {
|
||||
commandFn: actions.clearMeasurements,
|
||||
storeContexts: [],
|
||||
options: {},
|
||||
},
|
||||
};
|
||||
|
||||
return {
|
||||
actions,
|
||||
definitions,
|
||||
defaultContext: 'DEFAULT',
|
||||
};
|
||||
};
|
||||
|
||||
export default commandsModule;
|
||||
@@ -3,7 +3,7 @@ import { ViewModelContext } from '@ohif/core';
|
||||
|
||||
const HelloWorldContext = React.createContext({
|
||||
message: 'HelloWorldContextTesting',
|
||||
setMessage: () => {},
|
||||
setMessage: () => { },
|
||||
});
|
||||
|
||||
HelloWorldContext.displayName = 'HelloWorldContext';
|
||||
|
||||
@@ -4,6 +4,7 @@ import getLayoutTemplateModule from './getLayoutTemplateModule.js';
|
||||
import getPanelModule from './getPanelModule.js';
|
||||
import getSopClassHandlerModule from './getSopClassHandlerModule.js';
|
||||
import getToolbarModule from './getToolbarModule.js';
|
||||
import commandsModule from './commandsModule';
|
||||
import id from './id';
|
||||
|
||||
export default {
|
||||
@@ -17,4 +18,7 @@ export default {
|
||||
getPanelModule,
|
||||
getSopClassHandlerModule,
|
||||
getToolbarModule,
|
||||
getCommandsModule({ servicesManager }) {
|
||||
return commandsModule({ servicesManager });
|
||||
},
|
||||
};
|
||||
Reference in new issue
Block a user