minor code review

This commit is contained in:
gorhill 2015-05-30 13:44:55 -04:00
parent 3f9b704846
commit 67950ec135
1 changed files with 6 additions and 8 deletions

View File

@ -737,22 +737,20 @@ var elementFromPoint = function(x, y) {
var onSvgHovered = (function() {
var timer = null;
var position = { x: 0, y: 0 };
var mx = 0, my = 0;
var onTimer = function() {
timer = null;
var elem = elementFromPoint(position.x, position.y);
var elem = elementFromPoint(mx, my);
highlightElements(elem ? [elem] : []);
};
var onMove = function(ev) {
position.x = ev.clientX;
position.y = ev.clientY;
if ( timer !== null ) {
return;
mx = ev.clientX;
my = ev.clientY;
if ( timer === null ) {
timer = vAPI.setTimeout(onTimer, 40);
}
timer = vAPI.setTimeout(onTimer, 40);
};
return onMove;