LT-307 Reducing the amount of image redraws on tool activation from 52 to 44 (15% improvement)
This commit is contained in:
parent
debc294f33
commit
42c938fb44
@ -34,14 +34,23 @@ Meteor.startup(function() {
|
||||
touch: cornerstoneTools.exToolTouch
|
||||
});
|
||||
|
||||
let states = toolManager.getToolDefaultStates();
|
||||
states.deactivate.push('bidirectional');
|
||||
states.deactivate.push('nonTarget');
|
||||
states.deactivate.push('length');
|
||||
states.deactivate.push('crTool');
|
||||
states.deactivate.push('unTool');
|
||||
states.deactivate.push('exTool');
|
||||
// Update default state for tools making sure each tool is only inserted once
|
||||
let currentDefaultStates = toolManager.getToolDefaultStates();
|
||||
let newDefaultStates = {
|
||||
deactivate: ['bidirectional', 'nonTarget', 'length', 'crTool', 'unTool', 'exTool'],
|
||||
activate: ['deleteLesionKeyboardTool']
|
||||
};
|
||||
|
||||
for (let state in newDefaultStates) {
|
||||
newDefaultStates[state].forEach(function(tool) {
|
||||
let tools = currentDefaultStates[state];
|
||||
// make sure each tool is only inserted once
|
||||
if (tools && tools.indexOf(tool) < 0) {
|
||||
tools.push(tool);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
toolManager.setToolDefaultStates(currentDefaultStates);
|
||||
|
||||
states.activate.push('deleteLesionKeyboardTool');
|
||||
toolManager.setToolDefaultStates(states);
|
||||
});
|
||||
@ -171,7 +171,7 @@ toolManager = {
|
||||
|
||||
// First, deactivate the current active tool
|
||||
tools[activeTool].mouse.deactivate(element, 1);
|
||||
|
||||
|
||||
if (tools[activeTool].touch) {
|
||||
tools[activeTool].touch.deactivate(element);
|
||||
}
|
||||
@ -182,15 +182,15 @@ toolManager = {
|
||||
if (!relevantTools || !relevantTools.length || action === 'disabledToolButtons') {
|
||||
return;
|
||||
}
|
||||
|
||||
relevantTools.forEach(function(toolType) {
|
||||
if ((action === 'activate') ||
|
||||
(action === 'deactivate')) {
|
||||
tools[toolType].mouse[action](element, 1);
|
||||
} else {
|
||||
tools[toolType].mouse[action](element);
|
||||
// the currently active tool has already been deactivated and can be skipped
|
||||
if (action === 'deactivate' && toolType === activeTool) {
|
||||
return;
|
||||
}
|
||||
|
||||
tools[toolType].mouse[action](
|
||||
element,
|
||||
(action === 'activate' || action === 'deactivate' ? 1 : void 0)
|
||||
);
|
||||
tools[toolType].touch[action](element);
|
||||
});
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user