From 6a5ebb3e25c2fbca81c84b38a429b7c2aed13c77 Mon Sep 17 00:00:00 2001 From: Tomas Zubiri Date: Tue, 24 Sep 2019 18:20:06 -0300 Subject: [PATCH 1/2] initial attempt to simplify code and ui --- .../ConnectedPluginSwitch.js | 49 ++----------------- .../src/connectedComponents/PluginSwitch.js | 8 +-- 2 files changed, 9 insertions(+), 48 deletions(-) diff --git a/platform/viewer/src/connectedComponents/ConnectedPluginSwitch.js b/platform/viewer/src/connectedComponents/ConnectedPluginSwitch.js index 3c5ded332f8..847e44481c4 100644 --- a/platform/viewer/src/connectedComponents/ConnectedPluginSwitch.js +++ b/platform/viewer/src/connectedComponents/ConnectedPluginSwitch.js @@ -38,48 +38,7 @@ const mergeProps = (propsFromState, propsFromDispatch, ownProps) => { // TODO: Do not display certain options if the current display set // cannot be displayed using these view types - const buttons = [ - /*{ - text: 'Acquired', - type: 'command', - icon: 'bars', - active: false, - onClick: () => { - console.warn('Original Acquisition'); - - const layoutData = setSingleLayoutData( - layout.viewports, - activeViewportIndex, - { plugin: 'cornerstone' } - ); - - setLayout({ viewports: layoutData }); - }, - }, - { - text: 'Axial', - icon: 'cube', - active: false, - onClick: () => { - commandsManager.runCommand('axial'); - }, - }, - { - text: 'Sagittal', - icon: 'cube', - active: false, - onClick: () => { - commandsManager.runCommand('sagittal'); - }, - }, - { - text: 'Coronal', - icon: 'cube', - active: false, - onClick: () => { - commandsManager.runCommand('coronal'); - }, - },*/ + const button = { label: "2D MPR", icon: "cube", @@ -87,10 +46,10 @@ const mergeProps = (propsFromState, propsFromDispatch, ownProps) => { commandsManager.runCommand("mpr2d"); } } - ]; + ; return { - buttons + button }; }; @@ -100,4 +59,4 @@ const ConnectedPluginSwitch = connect( mergeProps )(PluginSwitch); -export default ConnectedPluginSwitch; +export default ConnectedPluginSwitch; \ No newline at end of file diff --git a/platform/viewer/src/connectedComponents/PluginSwitch.js b/platform/viewer/src/connectedComponents/PluginSwitch.js index 9865da3c0ff..740844722b8 100644 --- a/platform/viewer/src/connectedComponents/PluginSwitch.js +++ b/platform/viewer/src/connectedComponents/PluginSwitch.js @@ -1,11 +1,11 @@ import React, { Component } from 'react'; import PropTypes from 'prop-types'; -import { ExpandableToolMenu } from '@ohif/ui'; +import { ToolbarButton } from '@ohif/ui'; import './PluginSwitch.css'; class PluginSwitch extends Component { static propTypes = { - buttons: PropTypes.array, + button: PropTypes.any, }; static defaultProps = {}; @@ -13,7 +13,9 @@ class PluginSwitch extends Component { render() { return (
- +
); } From c57298475af444b7db15ea52ab72c2b3a84e65a6 Mon Sep 17 00:00:00 2001 From: Tomas Zubiri Date: Tue, 24 Sep 2019 18:43:32 -0300 Subject: [PATCH 2/2] UI fix: Collapsed 2dMPR button to main toolbar --- .../src/connectedComponents/ConnectedPluginSwitch.js | 9 ++------- platform/viewer/src/connectedComponents/PluginSwitch.js | 4 ++-- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/platform/viewer/src/connectedComponents/ConnectedPluginSwitch.js b/platform/viewer/src/connectedComponents/ConnectedPluginSwitch.js index 847e44481c4..24221887b0b 100644 --- a/platform/viewer/src/connectedComponents/ConnectedPluginSwitch.js +++ b/platform/viewer/src/connectedComponents/ConnectedPluginSwitch.js @@ -38,18 +38,13 @@ const mergeProps = (propsFromState, propsFromDispatch, ownProps) => { // TODO: Do not display certain options if the current display set // cannot be displayed using these view types - const button = - { - label: "2D MPR", - icon: "cube", - onClick: () => { + const mpr = () => { commandsManager.runCommand("mpr2d"); } - } ; return { - button + mpr }; }; diff --git a/platform/viewer/src/connectedComponents/PluginSwitch.js b/platform/viewer/src/connectedComponents/PluginSwitch.js index 740844722b8..f9437cef63c 100644 --- a/platform/viewer/src/connectedComponents/PluginSwitch.js +++ b/platform/viewer/src/connectedComponents/PluginSwitch.js @@ -5,7 +5,7 @@ import './PluginSwitch.css'; class PluginSwitch extends Component { static propTypes = { - button: PropTypes.any, + mpr: PropTypes.func, }; static defaultProps = {}; @@ -15,7 +15,7 @@ class PluginSwitch extends Component {
+ onClick = {this.props.mpr} />
); }