mirror of https://github.com/gorhill/uBlock.git
coalesce mouse move events
This commit is contained in:
parent
a51422c3df
commit
56ac5a1105
|
@ -735,10 +735,28 @@ var elementFromPoint = function(x, y) {
|
|||
|
||||
/******************************************************************************/
|
||||
|
||||
var onSvgHovered = function(ev) {
|
||||
var elem = elementFromPoint(ev.clientX, ev.clientY);
|
||||
highlightElements(elem ? [elem] : []);
|
||||
};
|
||||
var onSvgHovered = (function() {
|
||||
var timer = null;
|
||||
var position = { x: 0, y: 0 };
|
||||
|
||||
var onTimer = function() {
|
||||
timer = null;
|
||||
var elem = elementFromPoint(position.x, position.y);
|
||||
highlightElements(elem ? [elem] : []);
|
||||
};
|
||||
|
||||
var onMove = function(ev) {
|
||||
position.x = ev.clientX;
|
||||
position.y = ev.clientY;
|
||||
if ( timer !== null ) {
|
||||
return;
|
||||
}
|
||||
|
||||
timer = vAPI.setTimeout(onTimer, 40);
|
||||
};
|
||||
|
||||
return onMove;
|
||||
})();
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
|
|
Loading…
Reference in New Issue