diff --git a/public/config/default.js b/public/config/default.js index 47aa41fe0..c53ad9274 100644 --- a/public/config/default.js +++ b/public/config/default.js @@ -56,5 +56,7 @@ window.config = { // lastImage nextViewportDisplaySet: ['pageup'], previousViewportDisplaySet: ['pagedown'], + // ~ Cornerstone Tools + setZoomTool: ['z'], }, }; diff --git a/src/appCommands/cornerstone.js b/src/appCommands/cornerstone.js index 89699a226..53e6ea7cc 100644 --- a/src/appCommands/cornerstone.js +++ b/src/appCommands/cornerstone.js @@ -1,4 +1,8 @@ import cornerstone from 'cornerstone-core'; +import { redux } from 'ohif-core'; +import store from './../store/'; + +const { setToolActive } = redux.actions; const actions = { rotateViewport: ({ viewports, rotation }) => { @@ -64,7 +68,6 @@ const actions = { cornerstone.reset(enabledElement); } }, - invertViewport: ({ viewports }) => { const enabledElement = _getActiveViewportEnabledElement( viewports.viewportSpecificData, @@ -77,6 +80,13 @@ const actions = { cornerstone.setViewport(enabledElement, viewport); } }, + // This has a weird hard dependency on the tools that are available as toolbar + // buttons. You can see this in `ohif-core/src/redux/reducers/tools.js` + // the `toolName` needs to equal the button's `command` property. + // NOTE: It would be nice if `hotkeys` could set this, instead of creating a command per tool + setCornerstoneToolActive: ({ toolName }) => { + store.dispatch(setToolActive(toolName)); + }, updateViewportDisplaySet: ({ direction }) => { // TODO console.warn('updateDisplaySet: ', direction); @@ -155,6 +165,12 @@ const definitions = { storeContexts: [], options: { direction: 1 }, }, + // TOOLS + setZoomTool: { + commandFn: actions.setCornerstoneToolActive, + storeContexts: [], + options: { toolName: 'Zoom' }, + }, }; /**