LT-307 Reducing the amount of image redraws on tool activation from 52 to 44 (15% improvement)

This commit is contained in:
Emanuel F. Oliveira authored and Erik Ziegler committed 2016-11-15 08:29:46 +01:00
1 parent debc294f33
commit 42c938fb44
2 files changed
+26 -17

No files matched your search

+8 -8
View File
@@ -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);
});
});