From 18792da43d67aef795c4df66abd2fdfedb446b12 Mon Sep 17 00:00:00 2001 From: Erik Ziegler Date: Mon, 31 Dec 2018 13:52:37 +0100 Subject: [PATCH] Fix toolbar buttons connection to redux --- OHIFViewer-react/public/icons.svg | 237 ++++++++++++++++++ .../ConnectedCornerstoneViewport.js | 4 +- .../FlexboxLayout/ConnectedToolbarSection.js | 6 +- 3 files changed, 244 insertions(+), 3 deletions(-) create mode 100644 OHIFViewer-react/public/icons.svg diff --git a/OHIFViewer-react/public/icons.svg b/OHIFViewer-react/public/icons.svg new file mode 100644 index 000000000..aa3817af6 --- /dev/null +++ b/OHIFViewer-react/public/icons.svg @@ -0,0 +1,237 @@ + + + HUD + + + + + + + + + Additional Measurements + + + + + + Lesions + + + + + + Settings + + + + Complete + + + + + + Locked + + + + Studies + + + + + + Window / Level + + + + + + + Link + + + + + + + Non-Target Measurement + + + + + + + + Target Measurement + + + + + + + Target CR Measurement + + CR + + + + + Target UN Measurement + + UN + + + + + Temporary Measurement + + + + + + + + More + + + + + + Pan + + + + + + + + + + + Zoom + + + + + + + Invert + + + + Stack Scroll + + + + Elliptical ROI + + + + Magnify + + + + Reset + + + + Rotate + + + + Rotate Right + + + + Cineplay Toggle + + + + Vertical + + + + Horizontal + + + + Trial Information + + + + + + Expand + + + + Add + + + + Close + + + + + + Comment + + + + + Capture Screen + + + + + + + + Warning + + + + + + + Viewport Link + + + + + + + Theme + + + + Log + + + + Server + + + + Study List + + + + Logout + + + + Password + + + diff --git a/OHIFViewer-react/src/FlexboxLayout/ConnectedCornerstoneViewport.js b/OHIFViewer-react/src/FlexboxLayout/ConnectedCornerstoneViewport.js index 2c2599b5c..0deca841a 100644 --- a/OHIFViewer-react/src/FlexboxLayout/ConnectedCornerstoneViewport.js +++ b/OHIFViewer-react/src/FlexboxLayout/ConnectedCornerstoneViewport.js @@ -5,9 +5,11 @@ import OHIF from 'ohif-core' const { setViewportActive } = OHIF.redux.actions; const mapStateToProps = state => { + const activeButton = state.tools.buttons.find(tool => tool.active === true); + return { activeViewportIndex: state.viewports.activeViewportIndex, - activeTool: state.tools.buttons.find(tool => tool.active === true).command + activeTool: activeButton && activeButton.command }; }; diff --git a/OHIFViewer-react/src/FlexboxLayout/ConnectedToolbarSection.js b/OHIFViewer-react/src/FlexboxLayout/ConnectedToolbarSection.js index 49e0be51b..59dfa2349 100644 --- a/OHIFViewer-react/src/FlexboxLayout/ConnectedToolbarSection.js +++ b/OHIFViewer-react/src/FlexboxLayout/ConnectedToolbarSection.js @@ -5,9 +5,11 @@ import OHIF from 'ohif-core' const { setToolActive } = OHIF.redux.actions; const mapStateToProps = state => { + const activeButton = state.tools.buttons.find(tool => tool.active === true); + return { buttons: state.tools.buttons, - activeCommand: state.tools.buttons.find(tool => tool.active === true).command + activeCommand: activeButton && activeButton.command }; }; @@ -15,7 +17,7 @@ const mapDispatchToProps = dispatch => { return { setToolActive: tool => { console.log(`setViewportActive: ${tool}`); - dispatch(setToolActive(tool)) + dispatch(setToolActive(tool.command)) } }; };