Add button/hotkey to show/hide tools in viewports

This commit is contained in:
Erik Ziegler committed 2015-12-11 17:55:26 +01:00
1 parent ba05a3d21e
commit b2d4812dd0
8 files changed
+119 -99

No files matched your search

@@ -0,0 +1,41 @@
/**
* Show / hide lesion tracker tools
*/
var previousStates;
var previousActiveTool;
var toolsShown = true;
toggleLesionTrackerTools = function() {
if (toolsShown === true) {
// Save the current settings for later
previousStates = toolManager.getToolDefaultStates();
previousActiveTool = toolManager.getActiveTool();
// Hide the tools (set them all to disabled)
var toolDefaultStates = {
activate: [],
deactivate: [],
enable: [],
disable: ['lesion', 'nonTarget']
};
toolManager.setToolDefaultStates(toolDefaultStates);
// Using setActiveTool with no arguments activates the
// default tool on all available viewports
toolManager.setActiveTool();
toolsShown = false;
} else {
// Show the tools (reload previous states)
toolManager.setToolDefaultStates(previousStates);
// Using setActiveTool with no elements specified activates
// the specified tool on all available viewports
toolManager.setActiveTool(previousActiveTool);
toolsShown = true;
}
};