Increase Javascript Mouse Events
I would like to know if is there any way to increase the sample rate of mousemove events of JS. When I c开发者_如何学Goross the window quickly I only get around 10-20 events, not enough for the purpose of the app, when I do it slowly I can reach +100;
Thanks in advance,
I think, but maybe i'm wrong, that mousemove
events "sample rate" is not determined by javascript, but from the sample rate of your mouse. This means that whenever the mouse sends an event to the browser, an event is fired (if the mouse has moved of at least one pixel) and you can respond to it.
Mouse with higher sample rates create more events (and are more precise), where mouse with lower sample rate create fewer events. This is why when you play quake 4 the sample rate of your mouse affects the precision of your aiming.
So i don't think it's a problem of javascript, and you should have your app respond accordingly to the events generated from the mouse. The same thing is done in first person shooter with the auto aiming option.
精彩评论