fix(toolManager) Fix default tools being overwritten (#215)
This commit is contained in:
parent
e55e2ad05a
commit
85e21181a8
@ -115,17 +115,14 @@ export const toolManager = {
|
||||
mouse: cornerstoneTools.arrowAnnotate,
|
||||
touch: cornerstoneTools.arrowAnnotateTouch
|
||||
});
|
||||
|
||||
toolManager.addTool('rotate', {
|
||||
mouse: cornerstoneTools.rotate,
|
||||
touch: cornerstoneTools.rotateTouchDrag
|
||||
});
|
||||
|
||||
toolManager.addTool('spine', {
|
||||
mouse: cornerstoneTools.textMarker,
|
||||
touch: cornerstoneTools.textMarkerTouch
|
||||
});
|
||||
|
||||
toolManager.addTool('crosshairs', {
|
||||
mouse: cornerstoneTools.crosshairs,
|
||||
touch: cornerstoneTools.crosshairsTouch
|
||||
@ -133,20 +130,23 @@ export const toolManager = {
|
||||
|
||||
// if a default tool is globally defined, make it the default tool...
|
||||
if (OHIF.viewer.defaultTool) {
|
||||
defaultTool.left = OHIF.viewer.defaultTool;
|
||||
this.setDefaultTool(OHIF.viewer.defaultTool);
|
||||
}
|
||||
|
||||
defaultMouseButtonTools = Meteor.settings && Meteor.settings.public && Meteor.settings.public.defaultMouseButtonTools;
|
||||
|
||||
// Override default tool if defined in settings
|
||||
const defaultLeft = (defaultMouseButtonTools && defaultMouseButtonTools.left) || 'wwwc';
|
||||
const defaultRight = (defaultMouseButtonTools && defaultMouseButtonTools.right) || 'zoom';
|
||||
const defaultMiddle = (defaultMouseButtonTools && defaultMouseButtonTools.middle) || 'pan';
|
||||
defaultTool = {
|
||||
left: defaultLeft,
|
||||
right: defaultRight,
|
||||
middle: defaultMiddle
|
||||
};
|
||||
if (defaultMouseButtonTools) {
|
||||
if (defaultMouseButtonTools.left) {
|
||||
this.setDefaultTool(defaultMouseButtonTools.left);
|
||||
}
|
||||
if (defaultMouseButtonTools.right) {
|
||||
this.setDefaultTool(defaultMouseButtonTools.right, 'right');
|
||||
}
|
||||
if (defaultMouseButtonTools.middle) {
|
||||
this.setDefaultTool(defaultMouseButtonTools.middle, 'middle');
|
||||
}
|
||||
}
|
||||
|
||||
this.configureTools();
|
||||
initialized = true;
|
||||
@ -565,7 +565,7 @@ export const toolManager = {
|
||||
}
|
||||
|
||||
if (!toolId) {
|
||||
toolId = defaultTool[button];
|
||||
toolId = this.getDefaultTool(button);
|
||||
}
|
||||
|
||||
// Otherwise, set the active tool for all viewport elements
|
||||
|
||||
Loading…
Reference in New Issue
Block a user