Repository navigation
Add whole-page translation scan on current main - #29
Merged
smnexstudio merged 4 commits intoNov 18, 2026
Merged
Conversation
The plan of a whole-page scan is pure logic, so it can be tested without a WebView: where to stop (70% of the viewport a step, always the bottom of the page), and what to keep when the patches do not fit in memory (the farthest from the viewport go first). translateViewportOnce is the body of translateViewport, extracted so a scan can run a step without the two follow-up captures (a page that was still loading, a canvas page with no text) that the continuous mode starts on its own. Nothing else changes.
…es it The three-dot menu gets a new item. It scrolls the page by itself, from the top to the bottom, and translates every stop with the machinery that is already there (capture, detect, OCR, translate, patches). The patches stay while the user stays on the page. The plan of the scan is pure logic (PageScanPlan): a step covers 70% of the viewport, so 30% overlaps and a bubble cut by one screenshot's edge is whole in the next; the last stop is always the bottom of the page. While the page is held the usual pruning is replaced by a memory budget of 96 MB of decoded bitmap bytes, so a scan does not lose its results: above the budget the patches farthest from the viewport go first, and those areas are re-made by the continuous mode when the user scrolls there. A scan that needs a key or runs on the device asks first how many screens it will be. Cancel scan keeps the session and the patches and scrolls back to where the scan started; a touch on the page stops it where the user is. Transient failures are retried twice and then counted as gaps; a missing key, an exceeded quota or a missing pack stop the scan at once and leave the failure in the bottom bar, which already offers the fix. Only pages that scroll as a window (vertical readers) are supported: a page that does not scroll is translated only as far as it shows, with a note saying so. No pipeline, detector, OCR, engine or capture code is touched.
…s it The scroll-back sat behind a local flag that was only set at the end of the try block, so a cancel (which leaves the block through the cancellation) never scrolled back: the page stayed wherever the scan had reached. The flag is now the field that cancelScan already sets, so the button scrolls back and a cancel by a touch (the user took over) does not.
7 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Scope
Replacement for #8. This branch contains only the four scan commits, without the offline-model library or LAN HTTP changes.
Validation