fix(jump): Jump to measurement wasn't jumping when presentation already existed (#3318)

* fix: Jump to measurement after presentation store

* Fix initial load of DICOM SR

* Fix measurement highlight issues

* Clear measurements changed to array

* Fix merge issues

* PR comments

* Removed unused formatting.  Change to single event

* Fix the unit test

* PR review comments

* refactor(viewport): simplify imports, align destructuring

Simplify import statements by removing unused imports, organize existing imports, and align destructured imports consistently across the component.

---------
This commit is contained in:
Bill Wallace authored and GitHub committed 2023-05-01 12:54:33 -04:00
1 parent 66f6e3eade
commit b5b936b53e
21 files changed
+640 -298

No files matched your search

@@ -7,8 +7,8 @@ import React, {
} from 'react';
import PropTypes from 'prop-types';
import isEqual from 'lodash.isequal';
import { ViewportGridService } from '@ohif/core';
import viewportLabels from '../utils/viewportLabels';
import getPresentationIds from './getPresentationIds';
const DEFAULT_STATE = {
activeViewportIndex: 0,
@@ -173,7 +173,7 @@ export function ViewportGridProvider({ children, service }) {
displaySetOptions,
viewportLabel: viewportLabels[viewportIndex],
};
viewportOptions.presentationIds = getPresentationIds(
viewportOptions.presentationIds = ViewportGridService.getPresentationIds(
newViewport,
viewports
);
@@ -265,7 +265,7 @@ export function ViewportGridProvider({ children, service }) {
state.viewports
);
if (!viewport.viewportOptions.presentationIds) {
viewport.viewportOptions.presentationIds = getPresentationIds(
viewport.viewportOptions.presentationIds = ViewportGridService.getPresentationIds(
viewport,
viewports
);
@@ -403,12 +403,16 @@ export function ViewportGridProvider({ children, service }) {
getNumViewportPanes,
]);
// run many of the calls through the service itself since we want to publish events
const api = {
getState,
setActiveViewportIndex: index => service.setActiveViewportIndex(index), // run it through the service itself since we want to publish events
setDisplaySetsForViewports,
setLayout: layout => service.setLayout(layout), // run it through the service itself since we want to publish events
reset,
setActiveViewportIndex: index => service.setActiveViewportIndex(index),
setDisplaySetsForViewport: props =>
service.setDisplaySetsForViewports([props]),
setDisplaySetsForViewports: props =>
service.setDisplaySetsForViewports(props),
setLayout: layout => service.setLayout(layout),
reset: () => service.reset(),
set: gridLayoutState => service.setState(gridLayoutState), // run it through the service itself since we want to publish events
getNumViewportPanes,
};
@@ -422,9 +426,7 @@ export function ViewportGridProvider({ children, service }) {
ViewportGridProvider.propTypes = {
children: PropTypes.any,
service: PropTypes.shape({
setServiceImplementation: PropTypes.func,
}).isRequired,
service: PropTypes.instanceOf(ViewportGridService).isRequired,
};
export const useViewportGrid = () => useContext(ViewportGridContext);