Fix config check in extension init
This commit is contained in:
parent
5c686268ab
commit
a22fd67e13
@ -102,7 +102,7 @@ export default function init({ servicesManager, configuration }) {
|
|||||||
];
|
];
|
||||||
|
|
||||||
/* Add extension tools configuration here. */
|
/* Add extension tools configuration here. */
|
||||||
const extensionToolsConfiguration = {
|
const internalToolsConfig = {
|
||||||
ArrowAnnotate: {
|
ArrowAnnotate: {
|
||||||
configuration: {
|
configuration: {
|
||||||
getTextCallback: (callback, eventDetails) =>
|
getTextCallback: (callback, eventDetails) =>
|
||||||
@ -113,19 +113,15 @@ export default function init({ servicesManager, configuration }) {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const isEmpty = obj => Object.keys(obj).length < 1;
|
/* Add tools with its custom props through extension configuration. */
|
||||||
if (!isEmpty(configuration.tools) || !isEmpty(extensionToolsConfiguration)) {
|
tools.forEach(tool => {
|
||||||
/* Add tools with its custom props through extension configuration. */
|
const toolName = tool.name.replace('Tool', '');
|
||||||
tools.forEach(tool => {
|
const externalToolsConfig = configuration.tools || {};
|
||||||
const toolName = tool.name.replace('Tool', '');
|
const externalToolProps = externalToolsConfig[toolName] || {};
|
||||||
const configurationToolProps = configuration.tools[toolName] || {};
|
const internalToolProps = internalToolsConfig[toolName] || {};
|
||||||
const extensionToolProps = extensionToolsConfiguration[toolName];
|
const props = merge(internalToolProps, externalToolProps);
|
||||||
let props = merge(extensionToolProps, configurationToolProps);
|
csTools.addTool(tool, props);
|
||||||
csTools.addTool(tool, props);
|
});
|
||||||
});
|
|
||||||
} else {
|
|
||||||
tools.forEach(tool => csTools.addTool(tool));
|
|
||||||
}
|
|
||||||
|
|
||||||
csTools.setToolActive('Pan', { mouseButtonMask: 4 });
|
csTools.setToolActive('Pan', { mouseButtonMask: 4 });
|
||||||
csTools.setToolActive('Zoom', { mouseButtonMask: 2 });
|
csTools.setToolActive('Zoom', { mouseButtonMask: 2 });
|
||||||
|
|||||||
@ -70,5 +70,5 @@ window.config = {
|
|||||||
// ~ Cornerstone Tools
|
// ~ Cornerstone Tools
|
||||||
{ commandName: 'setZoomTool', label: 'Zoom', keys: ['z'] },
|
{ commandName: 'setZoomTool', label: 'Zoom', keys: ['z'] },
|
||||||
],
|
],
|
||||||
cornerstoneExtensionConfig: { tools: {} },
|
cornerstoneExtensionConfig: {},
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user