liseur/docs/adr
Chmouel Boudjnah 92ddd43bc5
fix(reader): save where a scrolled book has got to (#79)
* fix(reader): save where a scrolled book has got to

A locator names a place; it does not carry a distance. Readium's
`firstVisibleElementLocator` answers with a selector and the words at
the top of the screen and nothing else — no progression, no position —
and `BookPositions.resolve` reads a locator with neither as the start
of its resource.

Auto-scroll is the one path that asks that question directly, because
Readium's own hundred-millisecond debounce never lands on a page that
never stops. So every save it made filed the reader at the top of the
chapter they were half way down: the footer, the pace estimator, and
the number calibre-web syncs outright and Komga and liseur-sync compare
when they disagree. Only local resume escaped it, the anchor saved
beside the number still being exact.

Measure the distance too. `ScrollProgression` reads the document's own
scroll offset over its own length, which is not an approximation of
Readium's convention but the inverse of it: `scrollToPosition` restores
a fraction by multiplying it back out against the same span. A page
that cannot give one saves nothing that tick — a place a line behind is
worth having, a place a chapter behind is not.

The same round trip now keeps a place for a manually scrolled book. Its
debounce does land, but it lands after `ReaderActivity` has marked the
reader inactive if they leave the moment they stop scrolling, and is
dropped as movement nobody made. The web view's own scroll offset is
watched instead — a field read every couple of seconds — and the
document asked only once it has moved.

One `HeldPlace` is shared between the two loops. A measurement takes
several round trips into a document the reader is still moving through,
so it is held against a mark taken before the asking began, and the
first answer to land is the one that stands. A locator Readium
announces invalidates the ones in flight but does not clear what is
held until its own capture has been taken — that capture suspends, and
clearing early would leave a reader who left mid-capture with neither.

* fix(reader): do not save a place from a collector already stood down
2026-08-25 18:01:47 +02:00
..
0001-advanced-reading-menu.md feat(reader): scroll the page for me (#75) 2026-08-24 23:26:45 +02:00
0002-typography-fine-tuning.md docs: add GitHub issue references to architecture decision records 2026-08-19 23:27:26 +02:00
0003-read-aloud-tts.md docs: add GitHub issue references to architecture decision records 2026-08-19 23:27:26 +02:00
0004-user-imported-fonts.md docs: add GitHub issue references to architecture decision records 2026-08-19 23:27:26 +02:00
0005-warm-light.md docs: add GitHub issue references to architecture decision records 2026-08-19 23:27:26 +02:00
0006-auto-scroll.md fix(reader): save where a scrolled book has got to (#79) 2026-08-25 18:01:47 +02:00
0007-scrubber-page-peek.md docs: add GitHub issue references to architecture decision records 2026-08-19 23:27:26 +02:00
0008-highlight-styles.md feat(sync): sync highlights, notes and bookmarks (#78) 2026-08-25 14:39:03 +02:00
0009-tap-zone-customization.md docs: add GitHub issue references to architecture decision records 2026-08-19 23:27:26 +02:00
0010-translation-on-selection.md docs: add GitHub issue references to architecture decision records 2026-08-19 23:27:26 +02:00
0011-annotation-sync.md feat(sync): sync highlights, notes and bookmarks (#78) 2026-08-25 14:39:03 +02:00