Improved PDF vertical reader zoom and orientation handling (#98)

- Implemented `fitZoom` calculation to properly center and scale pages, especially in landscape orientation.
- Updated `clampValues` and animation bounds to ensure content is correctly centered when zoomed out.
- Refined double-tap-to-zoom logic to toggle between `fitZoom`, 1x, and 2.5x scales.
- Replaced manual frame-based zooming with `Animatable.animateTo` for smoother transitions.
- Added `configChanges` to `MainActivity` in `AndroidManifest.xml` to handle orientation and screen size changes manually.
- Reduced delays and improved reliability of initial page snapping in `PdfViewerScreen`.
This commit is contained in:
Aryan 2026-03-20 11:11:48 +05:30 committed by GitHub
parent c9dc3ce8c2
commit a9c791120d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 136 additions and 107 deletions

View file

@ -2147,8 +2147,6 @@ fun PdfViewerScreen(
Timber.tag("PdfPositionDebug").i("UI: Restoration Start | Target: $targetPage | Mode: $displayMode | Total: $pageCount")
try {
delay(200)
when (displayMode) {
DisplayMode.PAGINATION -> {
if (pagerState.currentPage != targetPage) {
@ -2157,14 +2155,11 @@ fun PdfViewerScreen(
initialScrollDone = true
}
DisplayMode.VERTICAL_SCROLL -> {
var retries = 0
while (verticalReaderState.snapToPageHandler == null && retries < 20) {
delay(50)
retries++
while (verticalReaderState.snapToPageHandler == null) {
delay(16)
}
Timber.tag("PdfPositionDebug").d("UI: Executing Vertical snapToPage($targetPage) after $retries retries")
Timber.tag("PdfPositionDebug").d("UI: Executing Vertical snapToPage($targetPage)")
verticalReaderState.snapToPage(targetPage)
delay(100)
initialScrollDone = true
}
}