Inwerpsel / use-theme-editor

A React theme editor
GNU General Public License v3.0
4 stars 0 forks source link

Ensure amount of scroll wheel rotations always captured accurately regardless of settings that affect size of scroll delta #64

Open Inwerpsel opened 6 months ago

Inwerpsel commented 6 months ago

Currently, a fixed step size of 100 is used to calculate the amount of steps (individual rotations of a stepped mouse scroll wheel) to capture during wheel events. This is used for scrolling over the history component and scrolling over the frame scale slider.

It produces an accurate result even when the event fires with a longer delta. This happens if the wheel is scrolled fast enough and/or a long running task delays the event.

This is probably the default step size on most devices, but I'm sure it can have another value depending on multiple factors in the environment.

Since the amount of steps is rounded to the nearest integer, step sizes between 50 and 100 should still have the same behavior when scrolling one at a time, and only when the delta comprises multiple steps would become somewhat slower.

Values below 50, however, will result in 0 steps because of rounding down.

Deltas above 150 would make it impossible to scroll one at a time.

Todo