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
|
touch: cornerstoneTools.exToolTouch
|
||||||
});
|
});
|
||||||
|
|
||||||
let states = toolManager.getToolDefaultStates();
|
// Update default state for tools making sure each tool is only inserted once
|
||||||
states.deactivate.push('bidirectional');
|
let currentDefaultStates = toolManager.getToolDefaultStates();
|
||||||
states.deactivate.push('nonTarget');
|
let newDefaultStates = {
|
||||||
states.deactivate.push('length');
|
deactivate: ['bidirectional', 'nonTarget', 'length', 'crTool', 'unTool', 'exTool'],
|
||||||
states.deactivate.push('crTool');
|
activate: ['deleteLesionKeyboardTool']
|
||||||
states.deactivate.push('unTool');
|
};
|
||||||
states.deactivate.push('exTool');
|
|
||||||
|
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
|
// First, deactivate the current active tool
|
||||||
tools[activeTool].mouse.deactivate(element, 1);
|
tools[activeTool].mouse.deactivate(element, 1);
|
||||||
|
|
||||||
if (tools[activeTool].touch) {
|
if (tools[activeTool].touch) {
|
||||||
tools[activeTool].touch.deactivate(element);
|
tools[activeTool].touch.deactivate(element);
|
||||||
}
|
}
|
||||||
@ -182,15 +182,15 @@ toolManager = {
|
|||||||
if (!relevantTools || !relevantTools.length || action === 'disabledToolButtons') {
|
if (!relevantTools || !relevantTools.length || action === 'disabledToolButtons') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
relevantTools.forEach(function(toolType) {
|
relevantTools.forEach(function(toolType) {
|
||||||
if ((action === 'activate') ||
|
// the currently active tool has already been deactivated and can be skipped
|
||||||
(action === 'deactivate')) {
|
if (action === 'deactivate' && toolType === activeTool) {
|
||||||
tools[toolType].mouse[action](element, 1);
|
return;
|
||||||
} else {
|
|
||||||
tools[toolType].mouse[action](element);
|
|
||||||
}
|
}
|
||||||
|
tools[toolType].mouse[action](
|
||||||
|
element,
|
||||||
|
(action === 'activate' || action === 'deactivate' ? 1 : void 0)
|
||||||
|
);
|
||||||
tools[toolType].touch[action](element);
|
tools[toolType].touch[action](element);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user