Commit Graph

10 Commits

Author SHA1 Message Date
schroda
5e10e1629f Fix intersection detection for horizontal pager 2025-02-19 16:44:01 +01:00
schroda
811b17361c Fix intersection root margin for horizontal pager 2025-02-19 16:39:55 +01:00
schroda
a45338647e Fix infinite scroll intersection info calculation
Scrollbars need to be considered since they decrease the available viewport size in which the element can be visible
2025-02-10 22:40:53 +01:00
schroda
a4e9e8f264 Introduce "useIntersectionObserver" hook 2025-02-08 19:45:41 +01:00
schroda
9d3aeafe0e Use "BasePager" for infinite scroll chapter change detection
There can be cases where when scrolling backward/forward the first/last page never gets visible in the viewport due to a large width/height of another page.
In that case the intersection observer would never trigger and thus, the chapter wouldn't get changed.

By using the Pager, which always takes up the full width/height, this problem will not be possible, since the start/end of the Pager always enters or leaves the viewport.
2025-02-05 22:25:35 +01:00
schroda
b12e28346c Improve reader infinite scroll chapter change detection
A 10% intersection threshold does not work for pages that are so long that 10% of the page will never be in the viewport
2025-02-05 21:23:20 +01:00
schroda
5e8b5545a6 Add comments to functions 2025-02-05 15:26:40 +01:00
schroda
34ebcc4f4c Improve naming of functions and variables 2025-02-05 15:17:48 +01:00
schroda
155f58b92d Consider only relevant element intersection for open prev/next chapter
In the "vertical mode" intersection changes for the left or right side of the element do not matter.
Same for "horizontal mode" the other way around.

If not handled accordingly, it would cause unwanted chapter changes.
2025-02-05 15:17:46 +01:00
schroda
4a9d2903b8 Add infinite scroll to reader 2025-02-03 17:17:35 +01:00