Fix #1409: Right page flip fails when fully zoomed in #1411
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.
Fix for Right Page Flip Failure when Fully Zoomed In
This PR addresses an issue in one-page view mode where flipping to the right page fails when the view is fully zoomed in. Specifically, in this mode and zoom state, the viewport ends up between two pages regardless of whether the left or right flip button is pressed. However, left flips succeed, while right flips fail. The primary modifications were made in the
Mode1UpLit.jsfile.Issue Analysis
✅ Root causes identified:
Zoom boundaries not defined:
The zooming logic lacked upper and lower bounds. Given the zoom factor:
and the following functions:
we observe exponential growth with no cap. This leads to scale explosion when zooming in repeatedly. Additionally, tests show that excessive zoom causes the viewport to reset to the first page instead of remaining on the current one.
Inadequate scrollTop calculation in
jumpToIndex:Under large zoom levels, although
scrollTopis updated, it's likely not sufficient due to browser viewport constraints. The scroll position is set to half a page above the new page top:At high zoom, this positions the viewport entirely within the inter-page spacing (usually black), causing the page flip logic to believe the right page wasn’t reached—because no new page content is visible.
Fix Implementation
✅ Two key changes were introduced:
Zoom scale bounds defined:
Reasonable min and max scale limits were added:
Modified zoom functions:
Updated
scrollTopcalculation:The scroll position now directly targets the top of the new page, preventing the viewport from falling into inter-page spacing at high zoom levels:
🛠 Testing
✅ Expected Result
I hope this helps!