Skip to content

fix(reader): correct paginated CFI anchor jumps#454

Open
codedogQBY wants to merge 1 commit into
mainfrom
codex/fix-cfi-column-navigation
Open

fix(reader): correct paginated CFI anchor jumps#454
codedogQBY wants to merge 1 commit into
mainfrom
codex/fix-cfi-column-navigation

Conversation

@codedogQBY

Copy link
Copy Markdown
Owner

Summary

  • Fix CSS-columns paginated anchor navigation by choosing anchor rects in logical reading-axis coordinates instead of raw physical x/y coordinates.
  • Account for the primary section's starting column within a rendered spread before converting CFI/fragment rects to page navigation.
  • Use the active view size when mapping RTL paginated rects, and rebuild the Expo reader bundle.

Root Cause

Footnote hrefs and AI citation CFIs both resolve to an anchor Range/Element and then call the paginator's scrollToAnchor. In paginated CSS-columns mode, the previous logic filtered rects with physical x/y >= 0 and converted iframe-local offsets directly to a spread page. That can pick the wrong rect in RTL/vertical/multi-column cases and misses the column offset when a section starts inside an existing spread, causing jumps to land one or more columns/pages away from the target.

Validation

  • node --check packages/foliate-js/paginator.js
  • pnpm --filter @readany/app-expo run build:reader
  • pnpm --filter @readany/app-expo exec tsc --noEmit
  • pnpm --filter app exec tsc --noEmit
  • git diff --check

Notes

  • pnpm exec biome check packages/foliate-js/paginator.js still fails on existing vendored-style lint rules in this file (single var declarators, assignment in expressions, string concatenation, etc.); the parse issue from the touched mapper code was removed.

Fixes #197

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] 脚注的跳转位置经常发生偏移,不在正确的位置上;ai生成内容的引用原文也会发生偏移

1 participant