fix(Image Download): various bug fixes for image download (#3396)
- prevent non-cornerstone viewports from showing the image download dialogue - passing the rendering engine id to ToolGroup.addViewport - fixed the keep/dismiss aspect feature
This commit is contained in:
parent
1881ce5cbc
commit
052653f3b2
@ -368,6 +368,21 @@ function commandsModule({
|
|||||||
},
|
},
|
||||||
showDownloadViewportModal: () => {
|
showDownloadViewportModal: () => {
|
||||||
const { activeViewportIndex } = viewportGridService.getState();
|
const { activeViewportIndex } = viewportGridService.getState();
|
||||||
|
|
||||||
|
if (
|
||||||
|
!cornerstoneViewportService.getCornerstoneViewportByIndex(
|
||||||
|
activeViewportIndex
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
// Cannot download a non-cornerstone viewport (image).
|
||||||
|
uiNotificationService.show({
|
||||||
|
title: 'Download Image',
|
||||||
|
message: 'Image cannot be downloaded',
|
||||||
|
type: 'error',
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const { uiModalService } = servicesManager.services;
|
const { uiModalService } = servicesManager.services;
|
||||||
|
|
||||||
if (uiModalService) {
|
if (uiModalService) {
|
||||||
|
|||||||
@ -217,7 +217,7 @@ const CornerstoneViewportDownloadForm = ({
|
|||||||
);
|
);
|
||||||
|
|
||||||
// add the viewport to the toolGroup
|
// add the viewport to the toolGroup
|
||||||
toolGroup.addViewport(downloadViewportId);
|
toolGroup.addViewport(downloadViewportId, renderingEngineId);
|
||||||
|
|
||||||
Object.keys(toolGroup._toolInstances).forEach(toolName => {
|
Object.keys(toolGroup._toolInstances).forEach(toolName => {
|
||||||
// make all tools Enabled so that they can not be interacted with
|
// make all tools Enabled so that they can not be interacted with
|
||||||
|
|||||||
@ -95,11 +95,11 @@ const ViewportDownloadForm = ({
|
|||||||
|
|
||||||
const onKeepAspectToggle = () => {
|
const onKeepAspectToggle = () => {
|
||||||
const { width, height } = dimensions;
|
const { width, height } = dimensions;
|
||||||
const aspectMultiplier = { ...aspectMultiplier };
|
|
||||||
if (!keepAspect) {
|
if (!keepAspect) {
|
||||||
const base = Math.min(width, height);
|
const aspectMultiplier = {
|
||||||
aspectMultiplier.width = width / base;
|
width: width / height,
|
||||||
aspectMultiplier.height = height / base;
|
height: height / width,
|
||||||
|
};
|
||||||
setAspectMultiplier(aspectMultiplier);
|
setAspectMultiplier(aspectMultiplier);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -379,7 +379,7 @@ const ViewportDownloadForm = ({
|
|||||||
|
|
||||||
<div className="mt-8">
|
<div className="mt-8">
|
||||||
<div
|
<div
|
||||||
className="p-4 rounded bg-secondary-dark border-secondary-primary"
|
className="p-4 rounded bg-secondary-dark border-secondary-primary w-max-content min-w-full"
|
||||||
data-cy="image-preview"
|
data-cy="image-preview"
|
||||||
>
|
>
|
||||||
<Typography variant="h5">{t('Image preview')}</Typography>
|
<Typography variant="h5">{t('Image preview')}</Typography>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user