fix(tool-manager): Instantiate cornerstone tools by element

This commit is contained in:
Evren Ozkan 2018-11-29 12:47:23 -05:00
parent e947f1fad0
commit 635c8b9119
2 changed files with 4 additions and 4 deletions

View File

@ -278,7 +278,7 @@ const loadDisplaySetIntoViewport = (data, templateData) => {
} }
// Instantiate the tools // Instantiate the tools
toolManager.instantiateTools(); toolManager.instantiateTools(element);
// Use the tool manager to enable the currently active tool for this // Use the tool manager to enable the currently active tool for this
// newly rendered element // newly rendered element

View File

@ -173,12 +173,12 @@ export const toolManager = {
Session.set('ToolManagerActiveToolUpdated', Random.id()); Session.set('ToolManagerActiveToolUpdated', Random.id());
}, },
instantiateTools() { instantiateTools(element) {
// Instantiate all cornerstone tools for all enabled elements // Instantiate all cornerstone tools for the given element
Object.keys(tools).forEach(toolName => { Object.keys(tools).forEach(toolName => {
const apiTool = cornerstoneTools[tools[toolName]]; const apiTool = cornerstoneTools[tools[toolName]];
if (apiTool) { if (apiTool) {
cornerstoneTools.addTool(apiTool, { cornerstoneTools.addToolForElement(element, apiTool, {
name: toolName, name: toolName,
configuration: defaultToolConfig configuration: defaultToolConfig
}); });