mirror of
https://github.com/readest/readest.git
synced 2026-11-29 19:02:28 +00:00
* Fix paper curl rendering and backward page turns * Add native Android paper curl and stabilize page turns * Preserve active paper turns and scope capture failure recovery * Clarify frame timing fraction in page curl documentation * chore: point the foliate-js submodule back at readest/foliate-js The pointer (6381a92) is the head of readest/foliate-js#139 and is fetchable from readest/foliate-js through refs/pull/139/head. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Hide cancelled native paper scenes and document rendering lifecycle * fix(android): clip native paper regions to the WebView Chrome's CSS viewport can overhang the WebView: on a Pixel 7 the reader is 412.19 x 915.05 CSS px, 1082 x 2402 px at 2.625, on a 1080 x 2400 px WebView. PixelCopy clipped that request to the window and stretched the rest over the 1082 x 2402 bitmap, so the native sheet and the page cover drew about 2 px larger than the live page. The page appeared to shrink when the live WebView took over before and after a curl. The native page region, its capture and cover_webview_region now convert CSS px through webViewRegion(), which clips to the WebView bounds. Verified: - NativePaperRegionTest fails on the unclipped arithmetic ("arrays first differed at element [2]; expected:<1080> but was:<1082>") and passes with the clip; all 24 native-bridge JVM tests pass. - x86_64 debug APK on an API 35 emulator (Pixel 7 profile): in a screen recording, consecutive flat frames of the same page jumped by (2, 2) px 29 times before the fix and 0 times after. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(android): turn two-column spreads with the native paper curl Landscape (two-column) EPUB spreads fell back to the captured curl, which captures at a 2x cap as JPEG and stretches the CSS viewport overhang into the bitmap, so the sheet looked soft and shifted by two pixels. The native scene now turns a spread too, modelled on the single-column path: the inner column stays flat, the outer column turns as a leaf hinged at the spine, and the leaf's back shows the facing page of the destination spread. Backward turns replay the previous spread's forward turn in reverse, as single-column does. The JS side passes the column count with `start` and enables the native path and page buffer for up to two columns on Android only. Verified: - NativePaperMeshTest: the spread mesh matches the browser mesh built by buildPageCurlMesh(..., 2), and a landed leaf mirrors its column (LTR and RTL). Both failed on the stub first ("expected:<2412> but was:<2376>"). - NativePaperTurnTest (API 35 emulator, 19/19): with the spread branch disabled the new spread test fails "Native frame at 4,320 expected:<-65536> but was:<-13121737>"; it passes with it. - native-page-turn.test.ts: 'tells the native scene how many columns the spread shows' failed first, passes now. - Emulator, landscape Alice in Wonderland: tap/drag forward and back, cancel, all land on the expected page; logcat shows paper_curl only, no capture_webview_region. During a slow drag the inner column differs from the live page by a mean 0.64 grey levels (6.13 with the captured curl) at the same sharpness, so no blur and no 2 px shift. - Not run: iOS (unchanged, still single-column only), a physical device. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(android): turn PDF and fixed-layout pages with the native paper curl Fixed-layout books (PDF, CBZ, fixed EPUB) fell back to the captured curl, which grabs the page as a 2x JPEG. They now use the native scene too: - foliate-js: the fixed-layout renderer names its pages with getPageTurnKey(), including the side shown in a portrait spread. - NativePageTurn no longer requires previewPage. A renderer without it captures the current page, navigates under the native cover, then captures the destination. Pages already resident (turning back) start at once. - On Android the page buffer follows native eligibility, so PDF sheets cover only the renderer, as EPUB sheets do. - The capture subscription now ignores a view-state write that changes no field. The bookmark ribbon rewrites its unchanged visibility on every relocation; that dropped the current sheet between capture and start of every cold turn, so each PDF turn failed with "Native page textures are not ready" and fell back to an unanimated jump. Found with CDP logpoints on the emulator. Verified: - fixed-layout-page-turn-key.browser.test.ts walks LTR/RTL books in portrait, landscape and single-page spreads; without the portrait-side prediction it fails "expected '2:left' to be '1:right'". - native-page-turn.test.ts 'turns a renderer without page previews...' failed first ("JPEG path must not run"), passes now. - useCapturedTurn-scrollLock.test.ts 'keeps native book textures when a view state is rewritten unchanged' failed first ("expected invalidateNativePages to not be called at all, but actually been called 1 times"). The recovery-path cases for fixed curl and curl without preview now expect the native path. - Related unit suites (633 tests) and lint pass. Fixed-layout browser files pass one by one; run together they hit "Cannot connect to the iframe", which main does the same. - Android emulator (API 35), Alice PDF: portrait, landscape single page and landscape two-page spreads. Taps, slow drag, tap/swipe back and a cancelled drag all land on the right page with an animated curl; only paper_curl IPC, no capture_webview_region, no interrupted turns. - Not run: a physical device, iOS (unchanged), CBZ. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(android): keep a cancelled native paper cover hidden when its scene arrives The native scene is prepared on the GL thread. A cancel that reached the main thread first hid the cover, and the late start callback then set alpha back to 1 and resumed dragging, so the stale sheet covered the live page until finish. The callback now leaves a cancelled scene hidden and not dragging; animate settles it back and finish ends it. Verified with NativePaperTurnTest aCancelBeforeTheSceneIsReadyKeepsTheCoverHidden on the API 35 emulator: without the fix it fails "A cancelled scene must not restore its cover expected:<0.0> but was:<1.0>"; with it all 20 NativePaperTurnTest cases and the plugin JVM tests pass. Raised by CodeRabbit on PR 7001. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(android): keep the resident native page when its replacement upload turns stale Uploading a page that was already resident reused its texture id. If the request turned stale after texImage2D, the upload deleted that id and dropped the key, while JS, which only reads the bank on success, still counted the page as resident; the next scene failed with "Native page textures are not ready". The replacement now goes into a new texture; a stale one deletes only itself, and a valid one replaces the old. Verified with NativePaperTurnTest aStaleReplacementUploadKeepsTheResidentPage on the API 35 emulator: without the fix it fails "The resident page stays in the bank"; with it all 21 NativePaperTurnTest cases and the plugin JVM tests pass. Not run: the app on a device with this change. Raised by CodeRabbit on PR 7001. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(page-curl): describe native curl for spreads and fixed layouts The doc still limited the Android native path to single-column reflowable books. It now covers two-column spreads, fixed layouts without previews, capture clipping to the WebView and unchanged reader-state writes, and lists the fixed-layout page-key browser test. Docs only; checked against the code in useCapturedTurn.ts, nativePageTurn.ts and NativePaperTurn.kt. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore(foliate-js): point at the merged readest/foliate-js#139 foliate-js#139 was squash-merged as 4b6b9f8. Its tree is identical to the PR head 2610185 this branch tested, so no code changes; the submodule now resolves from readest/foliate-js main. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Huang Xin <chrox.huang@gmail.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| foliate-js@4b6b9f8007 | ||
| js-mdict@d01bf62af8 | ||
| qcms@fc23a407f1 | ||
| simplecc-wasm@5e5b56f5b8 | ||
| swift-rs | ||
| tauri@382ea858bd | ||
| tauri-runtime-cef-stub | ||