Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mandate a minimum dispatch frequency for continuous UI input events #389

Open
KingSupernova31 opened this issue Nov 29, 2024 · 0 comments
Open

Comments

@KingSupernova31
Copy link

The frequency of mousemove events is left up to the implementation. In many browsers this is usually 15-60 events per second, which can result in the pointer skipping tens or even hundreds of pixels in between consecutive events. This poses a problem for applications that need careful tracking of the mouse position, as it results in unavoidable lag that can be very noticeable to the user. (Example)

Solution: Mandate a minimum frequency of mousemove events while the pointer is moving. I would suggest 250hz. I believe this would be fast enough to eliminate all noticeable lag in most practical situations, and it would still allow for 4ms per event, which is far more than enough for any competently-designed browser to process it. (Testing on Chrome it appears to take about 0.3ms to create and dispatch most mouse events.) Going above 250hz has diminishing returns since most monitors can't refresh faster than that anyway, so this seems like a reasonable middle ground.

The same should apply to pointermove, wheel, and any other event that exists as a discretization of some continuous input from the user.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant