Adding cornerstoneTools init()
This commit is contained in:
parent
e5e027f716
commit
fee6b240a4
@ -278,19 +278,14 @@ const loadDisplaySetIntoViewport = (data, templateData) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Enabling new eventDispatches form cornerstoneTools v3
|
// Enabling new eventDispatches form cornerstoneTools v3
|
||||||
cornerstoneTools.mouseInput.enable(element);
|
åtoolManager.cTools.addCanvas(element);
|
||||||
cornerstoneTools.mouseToolEventDispatcher.enable(element);
|
|
||||||
cornerstoneTools.touchInput.enable(element);
|
|
||||||
cornerstoneTools.touchToolEventDispatcher.enable(element);
|
|
||||||
cornerstoneTools.mouseWheelInput.enable(element);
|
|
||||||
cornerstoneTools.keyboardInput.enable(element);
|
|
||||||
|
|
||||||
toolManager.instantiateTools(element);
|
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
|
||||||
const activeTool = toolManager.getActiveTool();
|
const activeTool = toolManager.getActiveTool();
|
||||||
toolManager.setActiveTool(activeTool, [element]);
|
toolManager.cTools.setToolActive(element, activeTool);
|
||||||
|
|
||||||
// Define a function to run whenever the Cornerstone viewport is rendered
|
// Define a function to run whenever the Cornerstone viewport is rendered
|
||||||
// (e.g. following a change of window or zoom)
|
// (e.g. following a change of window or zoom)
|
||||||
|
|||||||
@ -32,11 +32,14 @@ export const toolManager = {
|
|||||||
this.setDefaultTool(OHIF.viewer.defaultTool);
|
this.setDefaultTool(OHIF.viewer.defaultTool);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.cTools = cornerstoneTools.init();
|
||||||
|
|
||||||
tools = [
|
tools = [
|
||||||
'length',
|
'length',
|
||||||
'angle',
|
'angle',
|
||||||
'wwwc',
|
'wwwc',
|
||||||
'zoom',
|
'zoom',
|
||||||
|
'pan',
|
||||||
'zoomTouchPinch',
|
'zoomTouchPinch',
|
||||||
'zoomMouseWheel',
|
'zoomMouseWheel',
|
||||||
'ellipticalRoi',
|
'ellipticalRoi',
|
||||||
@ -85,12 +88,12 @@ export const toolManager = {
|
|||||||
|
|
||||||
setActiveToolForElement(toolId, element) {
|
setActiveToolForElement(toolId, element) {
|
||||||
this.setAllToolsPassive(element);
|
this.setAllToolsPassive(element);
|
||||||
cornerstoneTools.setToolActive(element, toolId, { mouseButtonMask: 1 });
|
this.cTools.setToolActive(element, toolId, { mouseButtonMask: 1 });
|
||||||
},
|
},
|
||||||
|
|
||||||
setAllToolsPassive(element) {
|
setAllToolsPassive(element) {
|
||||||
cornerstoneTools.store.state.tools.forEach((tool) => {
|
this.cTools.store.state.tools.forEach((tool) => {
|
||||||
cornerstoneTools.setToolPassive(element, tool.name)
|
this.cTools.setToolPassive(element, tool.name)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -100,7 +103,7 @@ export const toolManager = {
|
|||||||
const apiTool = cornerstoneTools[`${toolName}Tool`];
|
const apiTool = cornerstoneTools[`${toolName}Tool`];
|
||||||
if (apiTool) {
|
if (apiTool) {
|
||||||
const tool = new apiTool();
|
const tool = new apiTool();
|
||||||
cornerstoneTools.addTool(element, tool);
|
this.cTools.addTool(element, tool);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user