Fix toolbar buttons connection to redux
This commit is contained in:
1 parent
5d6aad488e
commit
18792da43d
3 files changed
+244
-3
No files matched your search
@@ -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
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -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))
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user