Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added ability to change zoom using Ctrl + Scroll in Document Viewer #10964

Merged
merged 7 commits into from
Mar 4, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Limit zoom-out to ~1 page
Observed problems with infinite zoom-out:
- Occasional display errors (e.g. no text displayed for certain pages)
- No content can be seen if zoomed out too far, might be unclear to user what happened and that zooming in will fix problem
  • Loading branch information
cardionaut committed Mar 3, 2024
commit 4e609de1d3d6f6468d0f464827804bac438285af
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,16 @@ private void updateSizeOfDisplayedPages() {

public void changePageWidth(int delta) {
// Assuming the current page is A4 (or has same aspect ratio)
setPageWidth(desiredPageDimension.getWidth(Math.sqrt(2)) + delta);
int newWidth = desiredPageDimension.getWidth(Math.sqrt(2)) + delta;
// Limit zoom out to ~1 page due to occasional display errors when zooming out further
int minWidth = (int) (flow.getHeight() / 2 * Math.sqrt(2));
if (newWidth < minWidth) {
if (newWidth - delta == minWidth) { // Attempting to zoom out when already at minWidth
return;
}
newWidth = minWidth;
}
setPageWidth(newWidth);
}

/**
Expand Down