fix(reader): do not toggle bars on vertical pan swipes over fixed-layout pages - #5160
Merged
Conversation
…out pages The swipe-up gesture that toggles the header and footer bars was gated by zoomLevel <= 100 on fixed-layout books. But zoom level is a poor proxy for whether a vertical swipe pans the page: with fit-width mode at 100% zoom in landscape the page overflows vertically, so every pan swipe also popped up the control menu. Gate the toggle on actual vertical pannability instead, using the renderer's real isOverflowY() via hasVerticalPanning. A vertical swipe now toggles the bars only when it cannot pan the page. Fixes #5142 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Fixes #5142
Root cause
On paginated fixed-layout books, the swipe-up gesture that toggles the header and footer bars was gated by
zoomLevel <= 100inuseIframeEvents.ts. Zoom level is a poor proxy for whether a vertical swipe pans the page:isPanningViewtreatszoomMode !== 'fit-page'as pannable, and fit-width at 100% zoom in landscape overflows vertically. Every vertical pan swipe therefore also popped up the control menu.Fix
Gate the toggle on actual vertical pannability instead:
hasVerticalPanning(now exported fromusePagination.ts) combinesisPanningViewwith the renderer's realview.isOverflowY(). A vertical swipe toggles the bars only when it cannot pan the page. This also means a page zoomed beyond 100% that still fits vertically allows the swipe-up toggle again, since a vertical swipe pans nothing there.Tests
useTouchEvent.test.tsxcovering all four combinations (fit-width with and without vertical overflow, zoomed with and without vertical overflow); the overflowing fit-width case failed before the fix.Device verification (Xiaomi 13, adb + CDP)
Installed a dev build with the fix and drove the real app: opened a multi-page PDF via VIEW intent, rotated to landscape, set Fit Width through the UI. Swipe-up at the left side, right side, and center left the bars hidden while the page panned; a center tap still toggles the bars both ways; with Fit Page (no vertical overflow) swipe-up still toggles the bars.
🤖 Generated with Claude Code