fix: 🐛 Set series into active viewport by clicking on thumbnail (#945)

* fix: 🐛 Set series into active viewport by clicking on thumbnail

Users should be able to set the series for the active viewport by
clicking it's thumbnail into Study browser

Closes: #895

* fix: 🐛 Set series into active viewport by clicking on thumbnail

Small refactor into onClick data callback and thumbnailClick function

Closes: #895

* fix: 🐛 Refactor thumbnail click code changes

* fix: 🐛 We must clear the sopInstanceUid if we don't update it together with the viewportSpecificData, preventing console warning.

* fix: 🐛  Cleaning up a few more code changes
This commit is contained in:
Gustavo André Lelis 2019-09-26 11:08:30 -03:00 committed by Danny Brown
parent a9ca3fa026
commit 5551f817e3
2 changed files with 18 additions and 3 deletions

View File

@ -99,13 +99,13 @@ class ThumbnailEntry extends Component {
onClick = () => {
if (this.props.onClick) {
this.props.onClick();
this.props.onClick(this.props.displaySetInstanceUid);
}
};
onDoubleClick = () => {
if (this.props.onDoubleClick) {
this.props.onDoubleClick();
this.props.onDoubleClick(this.props.displaySetInstanceUid);
}
};
}

View File

@ -1,7 +1,10 @@
import OHIF from '@ohif/core';
import { connect } from 'react-redux';
import { StudyBrowser } from '@ohif/ui';
import cloneDeep from 'lodash.clonedeep';
const { setActiveViewportSpecificData } = OHIF.redux.actions;
// TODO
// - Determine in which display set is active from Redux (activeViewportIndex and layout viewportData)
// - Pass in errors and stack loading progress from Redux
@ -32,9 +35,21 @@ const mapStateToProps = (state, ownProps) => {
};
};
const mapDispatchToProps = dispatch => {
return {
onThumbnailClick: displaySetInstanceUid => {
dispatch(
setActiveViewportSpecificData({
displaySetInstanceUid,
})
);
},
};
};
const ConnectedStudyBrowser = connect(
mapStateToProps,
null
mapDispatchToProps
)(StudyBrowser);
export default ConnectedStudyBrowser;