How to set mousemove update speed?

You can’t. The mousemove events are generated by the browser, and thus you are receiving them as fast as the browser is generating them.

The browser is not obliged to generate the events at any given rate (either by pixels moved, or by time elapsed): if you move the mouse quickly, you will see that a “jump” in coordinates is reported, as the browser is reporting “the mouse has moved, and it is now here”, not “…and went through these pixels”. In fact, a browser on a slow computer might generate fewer mousemove events, lest the page slow down to a crawl.

What you could do is to connect successive positions from mousemove events with a straight line – this will obviously not get you any more precision, but it may mitigate the impact.

Leave a Comment