Files
ohif-viewer/platform/viewer/src/appExtensions/GenericViewerCommands/commandsModule.js
T

39 lines
1.0 KiB
JavaScript
Raw Normal View History

2019-05-31 16:25:10 -04:00
import { redux } from 'ohif-core';
2019-07-04 14:09:13 -04:00
import store from './../../store';
2019-05-31 16:25:10 -04:00
const { setViewportActive } = redux.actions;
const actions = {
updateViewportDisplaySet: ({ direction }) => {
// TODO
2019-07-04 14:09:13 -04:00
// console.warn('updateDisplaySet: ', direction);
2019-05-31 16:25:10 -04:00
},
updateActiveViewport: ({ viewports, direction }) => {
const { viewportSpecificData, activeViewportIndex } = viewports;
const maxIndex = Object.keys(viewportSpecificData).length - 1;
let newIndex = activeViewportIndex + direction;
newIndex = newIndex > maxIndex ? 0 : newIndex;
newIndex = newIndex < 0 ? maxIndex : newIndex;
store.dispatch(setViewportActive(newIndex));
},
};
const definitions = {
// Next/Previous active viewport
incrementActiveViewport: {
commandFn: actions.updateActiveViewport,
storeContexts: ['viewports'],
options: { direction: 1 },
},
decrementActiveViewport: {
commandFn: actions.updateActiveViewport,
storeContexts: ['viewports'],
options: { direction: -1 },
},
};
2019-07-04 14:09:13 -04:00
export default {
definitions,
defaultContext: 'VIEWER',
};