refactor: Viewports state (#1218)

* Organize viewports reducers

* Organize viewports actions

* Add local state to store dom node and remove hack

* Comment usage of dom in vtk

* Fix set of enabledElements

* Fix warning in html viewport

* Update docs for state

* Add commandsmanager to commandsmodule
This commit is contained in:
Igor Octaviano authored and Danny Brown committed 2019-12-02 11:29:04 -05:00
1 parent 0bb3eeb068
commit f396b30166
15 files changed
+505 -444

No files matched your search

@@ -2,6 +2,7 @@ import { connect } from 'react-redux';
import { CineDialog } from '@ohif/ui';
import OHIF from '@ohif/core';
import csTools from 'cornerstone-tools';
import { commandsManager } from './../App.js';
// Our target output kills the `as` and "import" throws a keyword error
// import { import as toolImport, getToolState } from 'cornerstone-tools';
import cloneDeep from 'lodash.clonedeep';
@@ -16,7 +17,8 @@ const { setViewportSpecificData } = OHIF.redux.actions;
const mapStateToProps = state => {
// Get activeViewport's `cine` and `stack`
const { viewportSpecificData, activeViewportIndex } = state.viewports;
const { cine, dom } = viewportSpecificData[activeViewportIndex] || {};
const { cine } = viewportSpecificData[activeViewportIndex] || {};
const dom = commandsManager.runCommand('getActiveViewportEnabledElement');
const cineData = cine || {
isPlaying: false,
@@ -3,15 +3,16 @@ import { ViewportDownloadForm } from '@ohif/ui';
import { utils } from '@ohif/core';
import cornerstone from 'cornerstone-core';
import cornerstoneTools from 'cornerstone-tools';
import { commandsManager } from './../App.js';
const MINIMUM_SIZE = 100;
const DEFAULT_SIZE = 512;
const MAX_TEXTURE_SIZE = 10000;
const mapStateToProps = (state, ownProps) => {
const { viewportSpecificData, activeViewportIndex } = state.viewports;
const { dom: activeEnabledElement } =
viewportSpecificData[activeViewportIndex] || {};
const activeEnabledElement = commandsManager.runCommand(
'getActiveViewportEnabledElement'
);
return {
onClose: ownProps.hide,