Skip to content

Commit

Permalink
fix(SM): drag and drop is now fixed for SM (#3813)
Browse files Browse the repository at this point in the history
  • Loading branch information
sedghi authored Nov 28, 2023
1 parent 4f9a00f commit f1a6764
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 10 deletions.
5 changes: 4 additions & 1 deletion extensions/default/src/Panels/PanelMeasurementTable.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React, { useEffect, useState } from 'react';
import PropTypes from 'prop-types';
import { useTranslation } from 'react-i18next';
import { utils, ServicesManager } from '@ohif/core';
import { MeasurementTable, Dialog, Input, useViewportGrid, ButtonEnums } from '@ohif/ui';
import ActionButtons from './ActionButtons';
Expand All @@ -18,6 +19,8 @@ export default function PanelMeasurementTable({
commandsManager,
extensionManager,
}): React.FunctionComponent {
const { t } = useTranslation('MeasurementTable');

const [viewportGrid, viewportGridService] = useViewportGrid();
const { activeViewportId, viewports } = viewportGrid;
const { measurementService, uiDialogService, uiNotificationService, displaySetService } = (
Expand Down Expand Up @@ -209,7 +212,7 @@ export default function PanelMeasurementTable({
data-cy={'measurements-panel'}
>
<MeasurementTable
title="Measurements"
title={t("Measurements")}
servicesManager={servicesManager}
data={displayMeasurements}
onClick={jumpToImage}
Expand Down
11 changes: 10 additions & 1 deletion extensions/dicom-microscopy/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { id } from './id';
import React, { Suspense } from 'react';
import React, { Suspense, useMemo } from 'react';
import getPanelModule from './getPanelModule';
import getCommandsModule from './getCommandsModule';

Expand Down Expand Up @@ -58,8 +58,17 @@ export default {
const [viewportGrid, viewportGridService] = useViewportGrid();
const { activeViewportId } = viewportGrid;

// a unique identifier based on the contents of displaySets.
// since we changed our rendering pipeline and if there is no
// element size change nor viewportId change we won't re-render
// we need a way to force re-rendering when displaySets change.
const displaySetsKey = useMemo(() => {
return props.displaySets.map(ds => ds.displaySetInstanceUID).join('-');
}, [props.displaySets]);

return (
<MicroscopyViewport
key={displaySetsKey}
servicesManager={servicesManager}
extensionManager={extensionManager}
commandsManager={commandsManager}
Expand Down
7 changes: 5 additions & 2 deletions modes/segmentation/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,11 @@ function modeFactory({ modeConfiguration }) {
* segmentations and we should exclude them
*/
isValidMode: ({ modalities }) => {
if (modalities.length === 1) {
return !['SM', 'US', 'MG', 'OT', 'DOC', 'CR'].includes(modalities[0]);
// Don't show the mode if the selected studies have only one modality
// that is not supported by the mode
const modalitiesArray = modalities.split('\\');
if (modalitiesArray.length === 1) {
return !['SM', 'US', 'MG', 'OT', 'DOC', 'CR'].includes(modalitiesArray[0]);
}

return true;
Expand Down
3 changes: 2 additions & 1 deletion platform/i18n/src/locales/en-US/MeasurementTable.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
"MAX": "MAX",
"NonTargets": "NonTargets",
"Relabel": "Relabel",
"Targets": "Targets"
"Targets": "Targets",
"Measurements": "Measurements"
}
10 changes: 5 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -14227,10 +14227,10 @@ [email protected]:
resolved "https://registry.yarnpkg.com/media-typer/-/media-typer-0.3.0.tgz#8710d7af0aa626f8fffa1ce00168545263255748"
integrity sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==

medium-zoom@^1.0.4:
version "1.0.8"
resolved "https://registry.yarnpkg.com/medium-zoom/-/medium-zoom-1.0.8.tgz#2bd1fbcf2961fa7b0e318fe284462aa9b8608ed2"
integrity sha512-CjFVuFq/IfrdqesAXfg+hzlDKu6A2n80ZIq0Kl9kWjoHh9j1N9Uvk5X0/MmN0hOfm5F9YBswlClhcwnmtwz7gA==
medium-zoom@^1.0.8:
version "1.1.0"
resolved "https://registry.yarnpkg.com/medium-zoom/-/medium-zoom-1.1.0.tgz#6efb6bbda861a02064ee71a2617a8dc4381ecc71"
integrity sha512-ewyDsp7k4InCUp3jRmwHBRFGyjBimKps/AJLjRSox+2q/2H4p/PNpQf+pwONWlJiOudkBXtbdmVbFjqyybfTmQ==

memfs@^3.1.2, memfs@^3.4.1, memfs@^3.4.12, memfs@^3.4.3:
version "3.6.0"
Expand Down Expand Up @@ -16166,7 +16166,7 @@ plugin-image-zoom@ataft/plugin-image-zoom:
version "1.1.0"
resolved "https://codeload.github.com/ataft/plugin-image-zoom/tar.gz/3e64669f3c8fb998a556432ca3f56e0f617454f2"
dependencies:
medium-zoom "^1.0.8"
medium-zoom "^1.0.4"

polished@^4.2.2:
version "4.2.2"
Expand Down

0 comments on commit f1a6764

Please sign in to comment.