tvhong / incremental-reading

Anki add-on providing incremental reading features
https://ankiweb.net/shared/info/935264945
ISC License
33 stars 7 forks source link

Up and Down arrow keys scroll too far if the IR note is long #12

Closed tvhong closed 1 year ago

tvhong commented 1 year ago

Describe the bug If the IR note is long enough, the Up and Down arrow keys scroll too far and this makes the keys unusable for reading.

To Reproduce Steps to reproduce the behavior:

  1. Import a very long note (e.g. https://super-memory.com/help/read.htm)
  2. Read it in Incremental Reading add-on
  3. Press "Down" key
  4. See that it scrolls much further than a single page

Expected behavior Up and Down arrow keys should only scroll half a page to a full page.

tvhong commented 1 year ago

Hm.. I can't reproduce this on Anki on my Mac.

tvhong commented 1 year ago

The logic of scrolling is:

let movementSize = window.innerHeight * getMovementFactor(e.code);

https://github.com/tvhong/incremental-reading/blob/main/ir/web/scroll.js#L40

window.innerHeight is the height of the view window, and the movementFactor are configurable via the add-on's configuration:

Screenshot 2023-02-20 at 11 33 04 AM

So, scrolling by 5% of view window should be consistent across articles of different length. So, the behavior on my Mac makes sense.

Maybe I made a mistake when reporting this issue?