OHIF-165 Make default mouse button tools configurable (wwwc, zoom, pan and stackScroll are currently supported)
This commit is contained in:
parent
a63a41ebde
commit
6d2c324c8f
@ -20,6 +20,8 @@ const wadoUriRootDefinitions = {
|
|||||||
max: 1000
|
max: 1000
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const availableMouseButtonTools = ['wwwc', 'zoom', 'pan', 'stackScroll'];
|
||||||
|
|
||||||
export const DICOMWebRequestOptions = new SimpleSchema({
|
export const DICOMWebRequestOptions = new SimpleSchema({
|
||||||
auth: {
|
auth: {
|
||||||
type: String,
|
type: String,
|
||||||
@ -186,6 +188,27 @@ export const PrefetchSchema = new SimpleSchema({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export const MouseButtonToolSchema = new SimpleSchema({
|
||||||
|
left: {
|
||||||
|
type: String,
|
||||||
|
label: 'Left Mouse Button',
|
||||||
|
allowedValues: availableMouseButtonTools,
|
||||||
|
optional: true
|
||||||
|
},
|
||||||
|
right: {
|
||||||
|
type: String,
|
||||||
|
label: 'Right Mouse Button',
|
||||||
|
allowedValues: availableMouseButtonTools,
|
||||||
|
optional: true
|
||||||
|
},
|
||||||
|
middle: {
|
||||||
|
type: String,
|
||||||
|
label: 'Middle Mouse Button',
|
||||||
|
allowedValues: availableMouseButtonTools,
|
||||||
|
optional: true
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
export const PublicServerConfig = new SimpleSchema({
|
export const PublicServerConfig = new SimpleSchema({
|
||||||
verifyEmail: {
|
verifyEmail: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
@ -204,6 +227,10 @@ export const PublicServerConfig = new SimpleSchema({
|
|||||||
prefetch: {
|
prefetch: {
|
||||||
type: PrefetchSchema,
|
type: PrefetchSchema,
|
||||||
label: 'Prefetch settings'
|
label: 'Prefetch settings'
|
||||||
|
},
|
||||||
|
defaultMouseButtonTools: {
|
||||||
|
type: MouseButtonToolSchema,
|
||||||
|
label: 'Default Mouse Button Tools'
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -9,6 +9,7 @@ import { textMarkerUtils } from './textMarkerUtils';
|
|||||||
|
|
||||||
let defaultTool = 'wwwc';
|
let defaultTool = 'wwwc';
|
||||||
let activeTool;
|
let activeTool;
|
||||||
|
let defaultMouseButtonTools;
|
||||||
|
|
||||||
let tools = {};
|
let tools = {};
|
||||||
|
|
||||||
@ -121,9 +122,13 @@ export const toolManager = {
|
|||||||
// 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) {
|
||||||
defaultTool = OHIF.viewer.defaultTool;
|
defaultTool = OHIF.viewer.defaultTool;
|
||||||
activeTool = defaultTool;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
defaultMouseButtonTools = Meteor.settings && Meteor.settings.public && Meteor.settings.public.defaultMouseButtonTools;
|
||||||
|
|
||||||
|
// Override default tool if defined in settings
|
||||||
|
defaultTool = (defaultMouseButtonTools && defaultMouseButtonTools.left) || "wwwc";
|
||||||
|
|
||||||
this.configureTools();
|
this.configureTools();
|
||||||
initialized = true;
|
initialized = true;
|
||||||
},
|
},
|
||||||
@ -304,9 +309,15 @@ export const toolManager = {
|
|||||||
// Get the imageIds for this element
|
// Get the imageIds for this element
|
||||||
const imageIds = toolData.data[0].imageIds;
|
const imageIds = toolData.data[0].imageIds;
|
||||||
|
|
||||||
|
const defaultMouseButtonToolNameMiddle = (defaultMouseButtonTools && defaultMouseButtonTools.middle) || "pan";
|
||||||
|
const defaultMouseButtonToolMiddle = cornerstoneTools[defaultMouseButtonToolNameMiddle];
|
||||||
|
|
||||||
|
const defaultMouseButtonToolNameRight = (defaultMouseButtonTools && defaultMouseButtonTools.right) || "zoom";
|
||||||
|
const defaultMouseButtonToolRight = cornerstoneTools[defaultMouseButtonToolNameRight];
|
||||||
|
|
||||||
// Deactivate all the middle mouse, right click, and scroll wheel tools
|
// Deactivate all the middle mouse, right click, and scroll wheel tools
|
||||||
cornerstoneTools.pan.deactivate(element);
|
defaultMouseButtonToolMiddle.deactivate(element);
|
||||||
cornerstoneTools.zoom.deactivate(element);
|
defaultMouseButtonToolRight.deactivate(element);
|
||||||
cornerstoneTools.zoomWheel.deactivate(element);
|
cornerstoneTools.zoomWheel.deactivate(element);
|
||||||
cornerstoneTools.stackScrollWheel.deactivate(element);
|
cornerstoneTools.stackScrollWheel.deactivate(element);
|
||||||
cornerstoneTools.panMultiTouch.disable(element);
|
cornerstoneTools.panMultiTouch.disable(element);
|
||||||
@ -315,7 +326,7 @@ export const toolManager = {
|
|||||||
cornerstoneTools.doubleTapZoom.disable(element);
|
cornerstoneTools.doubleTapZoom.disable(element);
|
||||||
|
|
||||||
// Reactivate the middle mouse and right click tools
|
// Reactivate the middle mouse and right click tools
|
||||||
cornerstoneTools.zoom.activate(element, 4); // zoom is the default tool for right mouse button
|
defaultMouseButtonToolRight.activate(element, 4); // zoom is the default tool for right mouse button
|
||||||
|
|
||||||
// Reactivate the relevant scrollwheel tool for this element
|
// Reactivate the relevant scrollwheel tool for this element
|
||||||
let multiTouchPanConfig;
|
let multiTouchPanConfig;
|
||||||
@ -347,10 +358,10 @@ export const toolManager = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// This block ensures that the middle mouse and scroll tools keep working
|
// This block ensures that the middle mouse and scroll tools keep working
|
||||||
if (tool === 'pan') {
|
if (tool === defaultMouseButtonToolNameMiddle) {
|
||||||
cornerstoneTools.pan.activate(element, 3); // 3 means left mouse button and middle mouse button
|
defaultMouseButtonToolMiddle.activate(element, 3); // 3 means left mouse button and middle mouse button
|
||||||
} else if (tool === 'crosshairs') {
|
} else if (tool === 'crosshairs') {
|
||||||
cornerstoneTools.pan.activate(element, 2); // pan is the default tool for middle mouse button
|
defaultMouseButtonToolMiddle.activate(element, 2); // pan is the default tool for middle mouse button
|
||||||
const currentFrameOfReferenceUID = getFrameOfReferenceUID(element);
|
const currentFrameOfReferenceUID = getFrameOfReferenceUID(element);
|
||||||
if (currentFrameOfReferenceUID) {
|
if (currentFrameOfReferenceUID) {
|
||||||
updateCrosshairsSynchronizer(currentFrameOfReferenceUID);
|
updateCrosshairsSynchronizer(currentFrameOfReferenceUID);
|
||||||
@ -359,12 +370,12 @@ export const toolManager = {
|
|||||||
// Activate the chosen tool
|
// Activate the chosen tool
|
||||||
tools[tool].mouse.activate(element, 1, synchronizer);
|
tools[tool].mouse.activate(element, 1, synchronizer);
|
||||||
}
|
}
|
||||||
} else if (tool === 'zoom') {
|
} else if (tool === defaultMouseButtonToolNameRight) {
|
||||||
cornerstoneTools.pan.activate(element, 2); // pan is the default tool for middle mouse button
|
defaultMouseButtonToolMiddle.activate(element, 2); // pan is the default tool for middle mouse button
|
||||||
cornerstoneTools.zoom.activate(element, 5); // 5 means left mouse button and right mouse button
|
defaultMouseButtonToolRight.activate(element, 5); // 5 means left mouse button and right mouse button
|
||||||
} else {
|
} else {
|
||||||
// Reactivate the middle mouse and right click tools
|
// Reactivate the middle mouse and right click tools
|
||||||
cornerstoneTools.pan.activate(element, 2); // pan is the default tool for middle mouse button
|
defaultMouseButtonToolMiddle.activate(element, 2); // pan is the default tool for middle mouse button
|
||||||
|
|
||||||
// Activate the chosen tool
|
// Activate the chosen tool
|
||||||
tools[tool].mouse.activate(element, 1);
|
tools[tool].mouse.activate(element, 1);
|
||||||
@ -431,8 +442,12 @@ export const toolManager = {
|
|||||||
Session.set('ToolManagerActiveTool', tool);
|
Session.set('ToolManagerActiveTool', tool);
|
||||||
},
|
},
|
||||||
getActiveTool() {
|
getActiveTool() {
|
||||||
// If toolManager is not initialized, we should set as defaultTool
|
|
||||||
if (!initialized) {
|
if (!initialized) {
|
||||||
|
toolManager.init();
|
||||||
|
}
|
||||||
|
|
||||||
|
// If activeTool is not defined, we should set as defaultTool
|
||||||
|
if (!activeTool) {
|
||||||
activeTool = defaultTool;
|
activeTool = defaultTool;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user