Add support for SET_LAYOUT action on viewportGrid reducer

This commit is contained in:
dannyrb committed 2020-06-07 11:48:13 -04:00
1 parent 490eefdae0
commit 0573cb18e6
3 files changed
+62 -35

No files matched your search

+21 -18
View File
@@ -3,15 +3,16 @@
import React from 'react';
import { useViewportGrid } from '@ohif/ui';
function getCommandsModule ({ servicesManager }) {
function getCommandsModule({ servicesManager }) {
const { UIDialogService } = servicesManager.services;
const definitions = {
toggleLayoutSelectionDialog: {
commandFn: () => {
if (!UIDialogService) {
window.alert('Unable to show dialog; no UI Dialog Service available.');
window.alert(
'Unable to show dialog; no UI Dialog Service available.'
);
return;
}
@@ -27,13 +28,12 @@ function getCommandsModule ({ servicesManager }) {
showOverlay: true,
content: Test,
});
},
storeContexts: [],
options: {},
context: 'VIEWER',
},
}
};
return {
definitions,
@@ -47,19 +47,22 @@ function Test() {
dispatch,
] = useViewportGrid();
return <div
onClick={() => {
dispatch({ type: '', payload: {
numCols: 2,
numRows: 2,
activeViewportIndex: 0,
viewports: [],
}})
}}
style={{ color: 'white' }}
>
Hello World!
</div>
return (
<div
onClick={() => {
dispatch({
type: 'SET_LAYOUT',
payload: {
numCols: 2,
numRows: 2,
},
});
}}
style={{ color: 'white' }}
>
Hello World!
</div>
);
}
export default getCommandsModule;