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
toolManager.instantiateTools();
toolManager.instantiateTools(element);
// Use the tool manager to enable the currently active tool for this
// newly rendered element

View File

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