Setting an active tool
This commit is contained in:
parent
a636df8fdc
commit
347680fdf5
@ -56,5 +56,7 @@ window.config = {
|
||||
// lastImage
|
||||
nextViewportDisplaySet: ['pageup'],
|
||||
previousViewportDisplaySet: ['pagedown'],
|
||||
// ~ Cornerstone Tools
|
||||
setZoomTool: ['z'],
|
||||
},
|
||||
};
|
||||
|
||||
@ -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' },
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Loading…
Reference in New Issue
Block a user