(x, y)
| 1335 | } |
| 1336 | |
| 1337 | _handleMouseMove(x, y) { |
| 1338 | this._mousePos = { 'x': x, 'y': y }; |
| 1339 | |
| 1340 | // Limit many mouse move events to one every MOUSE_MOVE_DELAY ms |
| 1341 | if (this._mouseMoveTimer == null) { |
| 1342 | |
| 1343 | const timeSinceLastMove = Date.now() - this._mouseLastMoveTime; |
| 1344 | if (timeSinceLastMove > MOUSE_MOVE_DELAY) { |
| 1345 | this._sendMouse(x, y, this._mouseButtonMask); |
| 1346 | this._mouseLastMoveTime = Date.now(); |
| 1347 | } else { |
| 1348 | // Too soon since the latest move, wait the remaining time |
| 1349 | this._mouseMoveTimer = setTimeout(() => { |
| 1350 | this._handleDelayedMouseMove(); |
| 1351 | }, MOUSE_MOVE_DELAY - timeSinceLastMove); |
| 1352 | } |
| 1353 | } |
| 1354 | } |
| 1355 | |
| 1356 | _handleDelayedMouseMove() { |
| 1357 | this._mouseMoveTimer = null; |
no test coverage detected