Commands running on at least first viewport
This commit is contained in:
parent
16aa777bda
commit
4ec357bec4
@ -7,6 +7,7 @@ import cornerstone from 'cornerstone-core';
|
|||||||
import debounce from 'lodash.debounce';
|
import debounce from 'lodash.debounce';
|
||||||
import throttle from 'lodash.throttle';
|
import throttle from 'lodash.throttle';
|
||||||
|
|
||||||
|
import { setEnabledElement } from './state';
|
||||||
|
|
||||||
// const {
|
// const {
|
||||||
// onAdded,
|
// onAdded,
|
||||||
@ -220,6 +221,14 @@ class OHIFCornerstoneViewport extends Component {
|
|||||||
isStackPrefetchEnabled={true} // todo
|
isStackPrefetchEnabled={true} // todo
|
||||||
isPlaying={false}
|
isPlaying={false}
|
||||||
frameRate={24}
|
frameRate={24}
|
||||||
|
// TODO: How do we share/track this?
|
||||||
|
// For example, Tracked Extension also wraps this component
|
||||||
|
// Could use window? Doesn't have to be reactive
|
||||||
|
// Need to expose viewportGrid as a "UI Service"
|
||||||
|
onElementEnabled={evt => {
|
||||||
|
const enabledElement = evt.detail.element;
|
||||||
|
setEnabledElement(viewportIndex, enabledElement);
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
{childrenWithProps}
|
{childrenWithProps}
|
||||||
</>
|
</>
|
||||||
|
|||||||
@ -24,8 +24,9 @@ const commandsModule = ({ servicesManager }) => {
|
|||||||
cornerstone.setViewport(enabledElement, viewport);
|
cornerstone.setViewport(enabledElement, viewport);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
flipViewportHorizontal: ({ viewports }) => {
|
flipViewportHorizontal: () => {
|
||||||
const enabledElement = getEnabledElement(viewports.activeViewportIndex);
|
const activeViewportIndex = 0;
|
||||||
|
const enabledElement = getEnabledElement(activeViewportIndex);
|
||||||
|
|
||||||
if (enabledElement) {
|
if (enabledElement) {
|
||||||
let viewport = cornerstone.getViewport(enabledElement);
|
let viewport = cornerstone.getViewport(enabledElement);
|
||||||
@ -56,15 +57,17 @@ const commandsModule = ({ servicesManager }) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
resetViewport: ({ viewports }) => {
|
resetViewport: () => {
|
||||||
const enabledElement = getEnabledElement(viewports.activeViewportIndex);
|
const activeViewportIndex = 0;
|
||||||
|
const enabledElement = getEnabledElement(activeViewportIndex);
|
||||||
|
|
||||||
if (enabledElement) {
|
if (enabledElement) {
|
||||||
cornerstone.reset(enabledElement);
|
cornerstone.reset(enabledElement);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
invertViewport: ({ viewports }) => {
|
invertViewport: () => {
|
||||||
const enabledElement = getEnabledElement(viewports.activeViewportIndex);
|
const activeViewportIndex = 0;
|
||||||
|
const enabledElement = getEnabledElement(activeViewportIndex);
|
||||||
|
|
||||||
if (enabledElement) {
|
if (enabledElement) {
|
||||||
let viewport = cornerstone.getViewport(enabledElement);
|
let viewport = cornerstone.getViewport(enabledElement);
|
||||||
@ -149,7 +152,7 @@ const commandsModule = ({ servicesManager }) => {
|
|||||||
return enabledElement;
|
return enabledElement;
|
||||||
},
|
},
|
||||||
showDownloadViewportModal: () => {
|
showDownloadViewportModal: () => {
|
||||||
const activeViewportIndex = 1; // viewports.activeViewportIndex;
|
const activeViewportIndex = 0; // viewports.activeViewportIndex;
|
||||||
const { UIModalService } = servicesManager.services;
|
const { UIModalService } = servicesManager.services;
|
||||||
if (UIModalService) {
|
if (UIModalService) {
|
||||||
UIModalService.show({
|
UIModalService.show({
|
||||||
@ -328,7 +331,7 @@ const commandsModule = ({ servicesManager }) => {
|
|||||||
},
|
},
|
||||||
rotateViewportCW: {
|
rotateViewportCW: {
|
||||||
commandFn: actions.rotateViewport,
|
commandFn: actions.rotateViewport,
|
||||||
storeContexts: ['viewports'],
|
storeContexts: [],
|
||||||
options: { rotation: 90 },
|
options: { rotation: 90 },
|
||||||
},
|
},
|
||||||
rotateViewportCCW: {
|
rotateViewportCCW: {
|
||||||
@ -338,7 +341,7 @@ const commandsModule = ({ servicesManager }) => {
|
|||||||
},
|
},
|
||||||
invertViewport: {
|
invertViewport: {
|
||||||
commandFn: actions.invertViewport,
|
commandFn: actions.invertViewport,
|
||||||
storeContexts: ['viewports'],
|
storeContexts: [],
|
||||||
options: {},
|
options: {},
|
||||||
},
|
},
|
||||||
flipViewportVertical: {
|
flipViewportVertical: {
|
||||||
@ -348,7 +351,7 @@ const commandsModule = ({ servicesManager }) => {
|
|||||||
},
|
},
|
||||||
flipViewportHorizontal: {
|
flipViewportHorizontal: {
|
||||||
commandFn: actions.flipViewportHorizontal,
|
commandFn: actions.flipViewportHorizontal,
|
||||||
storeContexts: ['viewports'],
|
storeContexts: [],
|
||||||
options: {},
|
options: {},
|
||||||
},
|
},
|
||||||
scaleUpViewport: {
|
scaleUpViewport: {
|
||||||
@ -368,7 +371,7 @@ const commandsModule = ({ servicesManager }) => {
|
|||||||
},
|
},
|
||||||
resetViewport: {
|
resetViewport: {
|
||||||
commandFn: actions.resetViewport,
|
commandFn: actions.resetViewport,
|
||||||
storeContexts: ['viewports'],
|
storeContexts: [],
|
||||||
options: {},
|
options: {},
|
||||||
},
|
},
|
||||||
clearAnnotations: {
|
clearAnnotations: {
|
||||||
|
|||||||
@ -74,7 +74,7 @@ export default [
|
|||||||
props: {
|
props: {
|
||||||
icon: 'tool-capture',
|
icon: 'tool-capture',
|
||||||
label: 'Reset View',
|
label: 'Reset View',
|
||||||
commandName: '',
|
commandName: 'resetViewport',
|
||||||
type: 'primary',
|
type: 'primary',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -84,7 +84,7 @@ export default [
|
|||||||
props: {
|
props: {
|
||||||
icon: 'tool-capture',
|
icon: 'tool-capture',
|
||||||
label: 'Rotate Right',
|
label: 'Rotate Right',
|
||||||
commandName: '',
|
commandName: 'rotateViewportCW',
|
||||||
type: 'primary',
|
type: 'primary',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -94,7 +94,7 @@ export default [
|
|||||||
props: {
|
props: {
|
||||||
icon: 'tool-capture',
|
icon: 'tool-capture',
|
||||||
label: 'Flip Horizontally',
|
label: 'Flip Horizontally',
|
||||||
commandName: '',
|
commandName: 'flipViewportHorizontal',
|
||||||
type: 'primary',
|
type: 'primary',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -134,7 +134,7 @@ export default [
|
|||||||
props: {
|
props: {
|
||||||
icon: 'tool-capture',
|
icon: 'tool-capture',
|
||||||
label: 'Invert',
|
label: 'Invert',
|
||||||
commandName: '',
|
commandName: 'invertViewport',
|
||||||
type: 'primary',
|
type: 'primary',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@ -74,7 +74,7 @@ export default [
|
|||||||
props: {
|
props: {
|
||||||
icon: 'tool-capture',
|
icon: 'tool-capture',
|
||||||
label: 'Reset View',
|
label: 'Reset View',
|
||||||
commandName: '',
|
commandName: 'resetViewport',
|
||||||
type: 'primary',
|
type: 'primary',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -84,7 +84,7 @@ export default [
|
|||||||
props: {
|
props: {
|
||||||
icon: 'tool-capture',
|
icon: 'tool-capture',
|
||||||
label: 'Rotate Right',
|
label: 'Rotate Right',
|
||||||
commandName: '',
|
commandName: 'rotateViewportCW',
|
||||||
type: 'primary',
|
type: 'primary',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -94,7 +94,7 @@ export default [
|
|||||||
props: {
|
props: {
|
||||||
icon: 'tool-capture',
|
icon: 'tool-capture',
|
||||||
label: 'Flip Horizontally',
|
label: 'Flip Horizontally',
|
||||||
commandName: '',
|
commandName: 'flipViewportHorizontal',
|
||||||
type: 'primary',
|
type: 'primary',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -134,7 +134,7 @@ export default [
|
|||||||
props: {
|
props: {
|
||||||
icon: 'tool-capture',
|
icon: 'tool-capture',
|
||||||
label: 'Invert',
|
label: 'Invert',
|
||||||
commandName: '',
|
commandName: 'invertViewport',
|
||||||
type: 'primary',
|
type: 'primary',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user