lusakasa / saka-key

A keyboard interface to the web
https://key.saka.io
MIT License
862 stars 70 forks source link

Scroll amount setting not respected #93

Open joefiesta opened 7 years ago

joefiesta commented 7 years ago

I set the "scroll amount" setting to 308.
I bind "scroll down" to K. I press K. My window scrolls 337 pixels.

  1. I have set SMOOTH SCROLLING off. With Smooth scrolling ON, this problem is FAR worse. The amount of a SCROLL DOWN seems to be a whole page.

    Also, with Smooth scrolling ON, keystrokes sent by Autohotkey are not handled correctly. Specifically, I have set autohotkey to send two "K" keystrokes when I press the Page Down key, when I am on certain web pages. But, when I hit the Page Down, SaraKey acts as if I had pressed the K key many, many times.

  2. You say "scroll amount" is a speed (in the doc). But, is it? I would think "scroll amount" is a number of pixels. What does "speed" have to do with scrolling?

eejdoowad commented 7 years ago

As you've discovered, Scroll Step behaves very differently based on whether smooth scrolling is enabled or disabled. When smooth scrolling is disabled, Scroll Step is the number of pixels moved every time your browser fires a keyboard event. When smooth scrolling is enabled, Scroll Step is the number of pixels moved every animation frame (typically 60Hz).

I should probably do some normalization so that the scroll speed is roughly comparable for the same Scroll Step setting regardless of scroll mode.

There is no native smooth scrolling in browsers, so I had to implement it myself. My implementation probably doesn't play well with your Autohotkeys setting. I'll have to do some experimenting.

TODO:

  1. Normalize Scroll Step
  2. Add explanation to handbook
  3. Investigate smooth scroll behavior with Autohotkeys