Skip to content

修复阅读器翻页落定时已加载图片闪烁 - #17

Merged
zilorn merged 2 commits into
mainfrom
codex/page-turn-images
Oct 11, 2026
Merged

zilorn merged 2 commits into
mainfrom
codex/page-turn-images

Conversation

@zilorn

@zilorn zilorn commented Oct 10, 2026 •

Copy link
Copy Markdown
Owner

解决的问题 / Problem

含插图的章节在翻页动画结束后,预览屏被卸载,当前屏重新挂载 <img>;即使图片地址已加载,新节点仍可能留下解码或绘制的空白帧。Fixes #15。

改动后的行为 / Resulting behavior

  • 当前屏与前后相邻屏共用按屏首复用的渲染窗口。翻页时直接露出真实目标屏,落页保留其块级图、行内图与正文节点,不再克隆目标屏或重挂图片。
  • 当前屏与预览屏均使用不透明主题纸张底色,预览屏的层级高于当前屏,避免折页揭开处两页文字叠显;不依赖 DOM 兄弟顺序。
  • 分页屏内图片使用 eager / sync 提前加载与解码,最多保留三屏;滚动模式继续使用 lazy / async。双页与末屏按实际存在的页渲染。
  • 当前正文与列引用随落页同步切换;选区菜单、书签闪亮查询限定当前屏。快速翻页打断、反向翻页、回弹、跨章加载和取消继续沿用既有行为。
  • 补充回归脚本并更新前端 skill 的阅读翻页约束。适用于手机与桌面共用的阅读页;没有增加界面元素或改变静态布局。

验证 / Validation

  • 类型检查 / Type check: pnpm exec tsc --noEmit 通过。
  • 文案检查 / i18n check: pnpm run i18n:check 通过;保留现有提示,无新增界面文案。
  • 前端构建 / Frontend build: pnpm build 通过。
  • Rust 测试(如适用)/ Rust tests (if applicable): 不涉及 Rust 修改,未运行。
  • 自动回归:node scripts/reader-page-turn-test.mjs、node scripts/reader-position-transition-test.mjs、node scripts/tts-follow-recovery-test.mjs、node scripts/reader-auto-page-test.mjs 全部通过;git diff --check 通过。
  • 浏览器验证 / Browser verification: 在 headless Chromium 的 390px 单页与 1100px 双页夹具中,提取并生产编译实际的 renderPagedSpread、图片组件、翻页入口与折页模块。验证已解码块图/行内图落页后仍为原节点、没有新增 load 事件,以及当前正文引用、回弹、快速打断、回翻、奇数末屏、重排释放和减少动态效果,均通过。夹具使用 data URL 图片与模拟章节,不等同于原生应用实测。
  • 动画画面验证:390px / 1100px × 浅色 / 深色 / 护眼主题,前后两个方向均通过。对比 25%、50%、75% 折页帧,移除真实旧正文不会改变阅读区像素;100% 揭开帧与目标屏单独显示逐像素一致,图片节点保持复用且无新增 load。旧实现能稳定复现 50% 帧的像素差异。此项仍使用浏览器夹具。
  • 未验证 / Not verified: Android / Linux / Windows 原生 Tauri 应用及 readerx-img 协议的瞬时视觉表现、原生音量键和真实跨章下载。设备验收建议:打开图片已加载的本地或在线章节,分别点按、横滑与快速连续翻页,再检查回弹、反向翻页和双页末屏。

数据与兼容性 / Data and compatibility

不涉及持久化格式、迁移、图片文件或协议地址修改。分页 DOM / 解码范围限制为当前及相邻屏,避免为整章保留图片节点;原生 WebView 仍需确认实际绘制与内存表现。

提交前检查 / Checklist

  • 已阅读 CONTRIBUTING.md 与 AGENTS.md / I read CONTRIBUTING.md and AGENTS.md.
  • 仅包含本次任务相关文件 / Changes are limited to this task.
  • 已更新相关文档与中英文文案(如适用)/ Relevant docs and both locales are updated where applicable.
  • 已完成适用检查,并说明未验证的部分 / Applicable checks are complete and unverified parts are explained.

@zilorn zilorn added the bug Something isn't working label Oct 11, 2026
@zilorn zilorn self-assigned this Oct 11, 2026
@zilorn
zilorn merged commit a0edc8e into main Oct 11, 2026
2 checks passed
@zilorn
zilorn deleted the codex/page-turn-images branch October 11, 2026 09:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

阅读器翻页动画结束后图片短暂闪烁(图片已加载完成)

1 participant