- Fixed by setting all tools to passive mode after instantiate then all
- Fixed the default tool that was not being set correctly. - Fixed some callouts done by Erik into my PR related with keeping old tool list
This commit is contained in:
parent
51c5c76eb9
commit
c30cdbe625
@ -43,7 +43,7 @@ OHIF.measurements.getImageDataUrl = ({
|
|||||||
});
|
});
|
||||||
|
|
||||||
cornerstoneTools.addToolState(element, measurement.toolType, state);
|
cornerstoneTools.addToolState(element, measurement.toolType, state);
|
||||||
cornerstoneTools[measurement.toolType].enable(element);
|
OHIF.viewerbase.toolManager.cTools.setToolEnabled(measurement.toolType);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the viewport voi if present
|
// Set the viewport voi if present
|
||||||
@ -59,7 +59,7 @@ OHIF.measurements.getImageDataUrl = ({
|
|||||||
|
|
||||||
// Disable the tool and clear the measurement state if a measurement was given
|
// Disable the tool and clear the measurement state if a measurement was given
|
||||||
if (measurement) {
|
if (measurement) {
|
||||||
cornerstoneTools[measurement.toolType].disable(element);
|
OHIF.viewerbase.toolManager.cTools.setToolDisabled(measurement.toolType);
|
||||||
cornerstoneTools.clearToolState(element, measurement.toolType);
|
cornerstoneTools.clearToolState(element, measurement.toolType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -284,7 +284,7 @@ const loadDisplaySetIntoViewport = (data, templateData) => {
|
|||||||
// 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.cTools.setToolActive(element, activeTool);
|
toolManager.setActiveTool(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)
|
||||||
|
|||||||
@ -111,11 +111,12 @@ Meteor.startup(function() {
|
|||||||
zoom: 'Zoom',
|
zoom: 'Zoom',
|
||||||
angle: 'Angle Measurement',
|
angle: 'Angle Measurement',
|
||||||
probe: 'Pixel Probe',
|
probe: 'Pixel Probe',
|
||||||
|
stackScroll: 'Stack Scroll',
|
||||||
ellipticalRoi: 'Elliptical ROI',
|
ellipticalRoi: 'Elliptical ROI',
|
||||||
rectangleRoi: 'Rectangle ROI',
|
rectangleRoi: 'Rectangle ROI',
|
||||||
magnify: 'Magnify',
|
magnify: 'Magnify',
|
||||||
arrowAnnotate: 'Annotate',
|
arrowAnnotate: 'Annotate',
|
||||||
stackScrollMouseWheel: 'Scroll Stack',
|
stackScrollMouseWheel: 'Scroll Stack Mouse Wheel',
|
||||||
pan: 'Pan',
|
pan: 'Pan',
|
||||||
length: 'Length Measurement',
|
length: 'Length Measurement',
|
||||||
wwwcRegion: 'W/L by Region',
|
wwwcRegion: 'W/L by Region',
|
||||||
|
|||||||
@ -12,7 +12,7 @@ import { textMarkerUtils } from './textMarkerUtils';
|
|||||||
import { isTouchDevice } from './helpers/isTouchDevice';
|
import { isTouchDevice } from './helpers/isTouchDevice';
|
||||||
|
|
||||||
let defaultTool = {
|
let defaultTool = {
|
||||||
left: 'wwwcTool',
|
left: 'wwwc',
|
||||||
right: 'zoom',
|
right: 'zoom',
|
||||||
middle: 'pan'
|
middle: 'pan'
|
||||||
};
|
};
|
||||||
@ -29,10 +29,10 @@ export const toolManager = {
|
|||||||
init() {
|
init() {
|
||||||
// if a default tool is globally defined, make it the default tool...
|
// if a default tool is globally defined, make it the default tool...
|
||||||
if (OHIF.viewer.defaultTool) {
|
if (OHIF.viewer.defaultTool) {
|
||||||
this.setDefaultTool(OHIF.viewer.defaultTool);
|
toolManager.setDefaultTool(OHIF.viewer.defaultTool);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.cTools = cornerstoneTools.init();
|
toolManager.cTools = cornerstoneTools.init();
|
||||||
|
|
||||||
tools = [
|
tools = [
|
||||||
'length',
|
'length',
|
||||||
@ -41,9 +41,10 @@ export const toolManager = {
|
|||||||
'wwwc',
|
'wwwc',
|
||||||
'zoom',
|
'zoom',
|
||||||
'pan',
|
'pan',
|
||||||
'probe',
|
'dragProbe',
|
||||||
'magnify',
|
'magnify',
|
||||||
'crosshairs',
|
'crosshairs',
|
||||||
|
'stackScroll',
|
||||||
'stackScrollMouseWheel',
|
'stackScrollMouseWheel',
|
||||||
'zoomTouchPinch',
|
'zoomTouchPinch',
|
||||||
'zoomMouseWheel',
|
'zoomMouseWheel',
|
||||||
@ -91,14 +92,20 @@ export const toolManager = {
|
|||||||
return tools;
|
return tools;
|
||||||
},
|
},
|
||||||
|
|
||||||
setActiveToolForElement(toolName) {
|
setActiveTool(toolName, button = 1) {
|
||||||
this.setAllToolsPassive();
|
toolManager.setAllToolsPassive();
|
||||||
this.cTools.setToolActive(toolName, { mouseButtonMask: 1 });
|
toolManager.cTools.setToolActive(toolName, { mouseButtonMask: button });
|
||||||
|
|
||||||
|
// TODO: add the active tool with the correct button
|
||||||
|
activeTool['left'] = toolName;
|
||||||
|
|
||||||
|
// Enable reactivity
|
||||||
|
Session.set('ToolManagerActiveToolUpdated', Random.id());
|
||||||
},
|
},
|
||||||
|
|
||||||
setAllToolsPassive() {
|
setAllToolsPassive() {
|
||||||
this.cTools.store.state.tools.forEach((tool) => {
|
toolManager.cTools.store.state.tools.forEach((tool) => {
|
||||||
this.cTools.setToolPassive(tool.name)
|
toolManager.cTools.setToolPassive(tool.name)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -106,43 +113,10 @@ export const toolManager = {
|
|||||||
Array.from(tools).forEach(toolName => {
|
Array.from(tools).forEach(toolName => {
|
||||||
const apiTool = cornerstoneTools[`${toolName}Tool`];
|
const apiTool = cornerstoneTools[`${toolName}Tool`];
|
||||||
if (apiTool) {
|
if (apiTool) {
|
||||||
this.cTools.addTool(apiTool);
|
toolManager.cTools.addTool(apiTool);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
toolManager.setAllToolsPassive();
|
||||||
|
|
||||||
setActiveTool(toolId, elements, button) {
|
|
||||||
let $elements;
|
|
||||||
if (!elements || !elements.length) {
|
|
||||||
$elements = $('.imageViewerViewport');
|
|
||||||
} else {
|
|
||||||
$elements = $(elements);
|
|
||||||
}
|
|
||||||
|
|
||||||
const checkElementEnabled = function(allElementsEnabled, element) {
|
|
||||||
try {
|
|
||||||
cornerstone.getEnabledElement(element);
|
|
||||||
|
|
||||||
return allElementsEnabled;
|
|
||||||
} catch (error) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// Otherwise, set the active tool for all viewport elements
|
|
||||||
$elements.each((index, element) => {
|
|
||||||
if (checkElementEnabled(element) === false) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
toolManager.setActiveToolForElement(toolId, element);
|
|
||||||
});
|
|
||||||
|
|
||||||
activeTool['left'] = toolId;
|
|
||||||
|
|
||||||
// Enable reactivity
|
|
||||||
Session.set('ToolManagerActiveToolUpdated', Random.id());
|
|
||||||
},
|
},
|
||||||
|
|
||||||
getNearbyToolData(element, coords, toolTypes) {
|
getNearbyToolData(element, coords, toolTypes) {
|
||||||
|
|||||||
@ -68,7 +68,7 @@ Template.toolbarSection.helpers({
|
|||||||
});
|
});
|
||||||
|
|
||||||
extraTools.push({
|
extraTools.push({
|
||||||
id: 'probe',
|
id: 'dragProbe',
|
||||||
title: 'Probe',
|
title: 'Probe',
|
||||||
classes: 'imageViewerTool',
|
classes: 'imageViewerTool',
|
||||||
iconClasses: 'fa fa-dot-circle-o'
|
iconClasses: 'fa fa-dot-circle-o'
|
||||||
@ -126,7 +126,7 @@ Template.toolbarSection.helpers({
|
|||||||
const buttonData = [];
|
const buttonData = [];
|
||||||
|
|
||||||
buttonData.push({
|
buttonData.push({
|
||||||
id: 'stackScrollMouseWheel',
|
id: 'stackScroll',
|
||||||
title: 'Stack Scroll',
|
title: 'Stack Scroll',
|
||||||
classes: 'imageViewerTool',
|
classes: 'imageViewerTool',
|
||||||
iconClasses: 'fa fa-bars'
|
iconClasses: 'fa fa-bars'
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user