2019-02-24 15:26:50 +01:00
|
|
|
import React, { Component } from 'react';
|
|
|
|
|
import PropTypes from 'prop-types';
|
2019-09-24 23:20:06 +02:00
|
|
|
import { ToolbarButton } from '@ohif/ui';
|
2019-03-01 10:55:52 +01:00
|
|
|
import './PluginSwitch.css';
|
2019-02-24 15:26:50 +01:00
|
|
|
|
|
|
|
|
class PluginSwitch extends Component {
|
|
|
|
|
static propTypes = {
|
2019-09-24 23:43:32 +02:00
|
|
|
mpr: PropTypes.func,
|
2019-10-14 14:41:29 +02:00
|
|
|
exitMpr: PropTypes.func
|
2019-02-24 15:26:50 +01:00
|
|
|
};
|
|
|
|
|
|
2019-03-01 10:55:52 +01:00
|
|
|
static defaultProps = {};
|
2019-10-14 14:41:29 +02:00
|
|
|
constructor(props) {
|
|
|
|
|
super(props);
|
|
|
|
|
this.state = {
|
|
|
|
|
isPlugSwitchOn: false,
|
|
|
|
|
label: "2D MPR",
|
|
|
|
|
icon: "cube"
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
handleClick = () => {
|
|
|
|
|
if (this.state.isPlugSwitchOn) {
|
|
|
|
|
this.setState({
|
|
|
|
|
isPlugSwitchOn: false,
|
|
|
|
|
label: "2D MPR",
|
|
|
|
|
icon: "cube"
|
|
|
|
|
});
|
|
|
|
|
this.props.exitMpr();
|
|
|
|
|
} else {
|
|
|
|
|
this.setState({
|
|
|
|
|
isPlugSwitchOn: true,
|
|
|
|
|
label: "Exit 2D MPR",
|
|
|
|
|
icon: "times"
|
|
|
|
|
});
|
|
|
|
|
this.props.mpr();
|
|
|
|
|
}
|
|
|
|
|
};
|
2019-02-24 15:26:50 +01:00
|
|
|
|
|
|
|
|
render() {
|
2019-10-14 14:41:29 +02:00
|
|
|
const { label, icon } = this.state;
|
|
|
|
|
|
2019-02-24 15:26:50 +01:00
|
|
|
return (
|
|
|
|
|
<div className="PluginSwitch">
|
2019-10-14 14:41:29 +02:00
|
|
|
<ToolbarButton label={label} icon={icon} onClick={this.handleClick} />
|
2019-02-24 15:26:50 +01:00
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default PluginSwitch;
|