mirror of https://github.com/gorhill/uBlock.git
coalesce mouse move events
This commit is contained in:
parent
a51422c3df
commit
56ac5a1105
|
@ -735,11 +735,29 @@ var elementFromPoint = function(x, y) {
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
var onSvgHovered = function(ev) {
|
var onSvgHovered = (function() {
|
||||||
var elem = elementFromPoint(ev.clientX, ev.clientY);
|
var timer = null;
|
||||||
|
var position = { x: 0, y: 0 };
|
||||||
|
|
||||||
|
var onTimer = function() {
|
||||||
|
timer = null;
|
||||||
|
var elem = elementFromPoint(position.x, position.y);
|
||||||
highlightElements(elem ? [elem] : []);
|
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;
|
||||||
|
})();
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
var onSvgClicked = function(ev) {
|
var onSvgClicked = function(ev) {
|
||||||
|
|
Loading…
Reference in New Issue