If the user is holding right-click and moving their mouse very slowly (having
a very small k can exasperate this), this script wouldn't scroll at all. This
is because dY remainder from conversion to moves was not stored. By allowing dY
to have a remainder between loops, we can get more consistent scrolling and
better operation when slowly moving the mouse.
Test the original bug by setting k to 0.01. Run the script, hold right-click,
and move the mouse very slowly (2 pixel per sec). You'll notice no movement
without this fix.
If the user is holding right-click and moving their mouse very slowly (having a very small k can exasperate this), this script wouldn't scroll at all. This is because dY remainder from conversion to moves was not stored. By allowing dY to have a remainder between loops, we can get more consistent scrolling and better operation when slowly moving the mouse.
Test the original bug by setting k to 0.01. Run the script, hold right-click, and move the mouse very slowly (2 pixel per sec). You'll notice no movement without this fix.