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

39 lines
1.0 KiB
JavaScript
Raw Normal View History

2019-08-06 23:56:44 -04:00
import { redux } from "@ohif/core";
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));
2019-08-06 23:56:44 -04:00
}
2019-05-31 16:25:10 -04:00
};
const definitions = {
// Next/Previous active viewport
incrementActiveViewport: {
commandFn: actions.updateActiveViewport,
2019-08-06 23:56:44 -04:00
storeContexts: ["viewports"],
options: { direction: 1 }
},
decrementActiveViewport: {
commandFn: actions.updateActiveViewport,
2019-08-06 23:56:44 -04:00
storeContexts: ["viewports"],
options: { direction: -1 }
}
};
2019-07-04 14:09:13 -04:00
export default {
definitions,
2019-08-06 23:56:44 -04:00
defaultContext: "VIEWER"
2019-07-04 14:09:13 -04:00
};