Update to include layout control
This commit is contained in:
1 parent
b84fd28dc2
commit
2b8dfa4468
9 files changed
+194
-36
No files matched your search
@@ -13,4 +13,5 @@ body {
|
||||
padding: 0;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
font-family: Roboto,OpenSans,HelveticaNeue-Light,Helvetica Neue Light,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { LayoutButton } from 'react-viewerbase';
|
||||
import OHIF from 'ohif-core'
|
||||
|
||||
const { setLayout } = OHIF.redux.actions;
|
||||
|
||||
const mapStateToProps = state => {
|
||||
return {
|
||||
currentLayout: state.viewports.layout,
|
||||
};
|
||||
};
|
||||
|
||||
const mapDispatchToProps = dispatch => {
|
||||
return {
|
||||
// TODO: Change if layout switched becomes more complex
|
||||
onChange: selectedCell => {
|
||||
console.log(`setLayout: ${JSON.stringify(selectedCell)}`);
|
||||
|
||||
let viewports = [];
|
||||
const rows = selectedCell.row + 1;
|
||||
const columns = selectedCell.col + 1;
|
||||
const numViewports = rows * columns;
|
||||
for (let i = 0; i < numViewports; i++) {
|
||||
viewports.push({
|
||||
height: `${100 / rows}%`,
|
||||
width: `${100 / columns}%`
|
||||
});
|
||||
}
|
||||
const layout = {
|
||||
viewports
|
||||
};
|
||||
|
||||
dispatch(setLayout(layout))
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
const ConnectedLayoutButton = connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(LayoutButton);
|
||||
|
||||
export default ConnectedLayoutButton;
|
||||
@@ -0,0 +1,16 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { LayoutManager } from 'react-viewerbase';
|
||||
|
||||
const mapStateToProps = state => {
|
||||
return {
|
||||
layout: state.viewports.layout,
|
||||
activeViewportIndex: state.viewports.activeViewportIndex
|
||||
};
|
||||
};
|
||||
|
||||
const ConnectedLayoutManager = connect(
|
||||
mapStateToProps,
|
||||
null
|
||||
)(LayoutManager);
|
||||
|
||||
export default ConnectedLayoutManager;
|
||||
@@ -1,5 +1,6 @@
|
||||
import React, { Component } from "react";
|
||||
import ConnectedToolbarSection from './ConnectedToolbarSection';
|
||||
import ConnectedLayoutButton from './ConnectedLayoutButton';
|
||||
import PropTypes from 'prop-types';
|
||||
import { RoundedButtonGroup } from 'react-viewerbase';
|
||||
import './ToolbarRow.css';
|
||||
@@ -35,14 +36,13 @@ class ToolbarRow extends Component {
|
||||
const leftSidebarValue = this.props.leftSidebarOpen ? leftSidebarToggle[0].value : null;
|
||||
|
||||
return (<div className="ToolbarRow">
|
||||
<div className="clearfix">
|
||||
<div className="pull-left m-t-1">
|
||||
<RoundedButtonGroup options={leftSidebarToggle} value={leftSidebarValue} onValueChanged={this.onLeftSidebarValueChanged}/>
|
||||
</div>
|
||||
<ConnectedToolbarSection/>
|
||||
<div className="pull-right m-t-1 rm-x-1">
|
||||
{/* > roundedButtonGroup rightSidebarToggleButtonData */}
|
||||
</div>
|
||||
<div className="pull-left m-t-1 p-y-1" style={{ padding: '10px' }}>
|
||||
<RoundedButtonGroup options={leftSidebarToggle} value={leftSidebarValue} onValueChanged={this.onLeftSidebarValueChanged}/>
|
||||
</div>
|
||||
<ConnectedToolbarSection/>
|
||||
<ConnectedLayoutButton/>
|
||||
<div className="pull-right m-t-1 rm-x-1">
|
||||
{/* > roundedButtonGroup rightSidebarToggleButtonData */}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -3,9 +3,9 @@ import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import cornerstone from 'cornerstone-core';
|
||||
import cornerstoneTools from 'cornerstone-tools';
|
||||
import { LayoutManager } from 'react-viewerbase';
|
||||
import { OHIF } from 'ohif-core';
|
||||
import ConnectedCornerstoneViewport from './ConnectedCornerstoneViewport.js';
|
||||
import ConnectedLayoutManager from './ConnectedLayoutManager.js';
|
||||
import StackManager from '../lib/StackManager.js';
|
||||
import './ViewerMain.css';
|
||||
|
||||
@@ -72,13 +72,11 @@ class ViewerMain extends Component {
|
||||
});
|
||||
|
||||
// TODO: re-add plugins back in
|
||||
// TODO: We shouldn't just show hang display sets by default
|
||||
// TODO: We shouldn't just hang display sets by default
|
||||
const viewportData = displaySets.map((dSet, index) => {
|
||||
return this.getCornerstoneViewport(dSet, index);
|
||||
});
|
||||
|
||||
debugger;
|
||||
|
||||
this.setState({
|
||||
displaySets,
|
||||
viewportData
|
||||
@@ -86,11 +84,11 @@ class ViewerMain extends Component {
|
||||
}
|
||||
|
||||
getCornerstoneViewport(data, index) {
|
||||
debugger;
|
||||
const stack = getCornerstoneStack(this.props.studies, data)
|
||||
const viewportData = {
|
||||
stack,
|
||||
...data
|
||||
...data,
|
||||
viewportIndex: index
|
||||
};
|
||||
|
||||
return (<ConnectedCornerstoneViewport
|
||||
@@ -122,7 +120,7 @@ class ViewerMain extends Component {
|
||||
// TODO: Connect LayoutManager to redux
|
||||
return (
|
||||
<div className="ViewerMain">
|
||||
<LayoutManager viewportData={this.state.viewportData} setViewportData={this.setViewportData}/>
|
||||
<ConnectedLayoutManager viewportData={this.state.viewportData} setViewportData={this.setViewportData}/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -14,6 +14,56 @@ reducers.ui = ui;
|
||||
const combined = combineReducers(reducers)
|
||||
const store = createStore(combined);
|
||||
|
||||
const defaultButtons = [
|
||||
{
|
||||
command: 'Pan',
|
||||
type: 'tool',
|
||||
text: 'Pan',
|
||||
svgUrl: '/icons.svg#icon-tools-pan',
|
||||
active: false
|
||||
},
|
||||
{
|
||||
command: 'Zoom',
|
||||
type: 'tool',
|
||||
text: 'Zoom',
|
||||
svgUrl: '/icons.svg#icon-tools-zoom',
|
||||
active: false
|
||||
},
|
||||
{
|
||||
command: 'Bidirectional',
|
||||
type: 'tool',
|
||||
text: 'Bidirectional',
|
||||
svgUrl: '/icons.svg#icon-tools-measure-target',
|
||||
active: false
|
||||
},
|
||||
{
|
||||
command: 'StackScroll',
|
||||
type: 'tool',
|
||||
text: 'Stack Scroll',
|
||||
svgUrl: '/icons.svg#icon-tools-stack-scroll',
|
||||
active: false
|
||||
},
|
||||
{
|
||||
command: 'reset',
|
||||
type: 'command',
|
||||
text: 'Reset',
|
||||
svgUrl: '/icons.svg#icon-tools-reset',
|
||||
active: false
|
||||
},
|
||||
{
|
||||
command: 'Wwwc',
|
||||
type: 'tool',
|
||||
text: 'Manual',
|
||||
svgUrl: '/icons.svg#icon-tools-levels',
|
||||
active: true
|
||||
},
|
||||
];
|
||||
|
||||
store.dispatch({
|
||||
type: 'SET_AVAILABLE_BUTTONS',
|
||||
buttons: defaultButtons
|
||||
});
|
||||
|
||||
const servers = {
|
||||
dicomWeb: [
|
||||
{
|
||||
|
||||
@@ -1 +1 @@
|
||||
export default 'f91fd93462f991cf94eb03a747e40a51826f5eaf';
|
||||
export default 'b84fd28dc262d3d3c569b38ac9e386857cced3e2';
|
||||
Reference in new issue
Block a user