Skip to content
This repository was archived by the owner on Nov 10, 2025. It is now read-only.

Commit ef582c0

Browse files
committed
Merge branch 'master' of https://github.com/lugegege/AndroidPdfViewer into lugegege-master
2 parents 720fc21 + b29b8ce commit ef582c0

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

android-pdf-viewer/src/main/java/com/github/barteksc/pdfviewer/DragPinchManager.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -253,10 +253,12 @@ private void onBoundedFling(float velocityX, float velocityY) {
253253
public boolean onScale(ScaleGestureDetector detector) {
254254
float dr = detector.getScaleFactor();
255255
float wantedZoom = pdfView.getZoom() * dr;
256-
if (wantedZoom < MINIMUM_ZOOM) {
257-
dr = MINIMUM_ZOOM / pdfView.getZoom();
258-
} else if (wantedZoom > MAXIMUM_ZOOM) {
259-
dr = MAXIMUM_ZOOM / pdfView.getZoom();
256+
float minZoom = Math.min(MINIMUM_ZOOM, pdfView.getMinZoom());
257+
float maxZoom = Math.max(MAXIMUM_ZOOM, pdfView.getMaxZoom());
258+
if (wantedZoom < minZoom) {
259+
dr = minZoom / pdfView.getZoom();
260+
} else if (wantedZoom > maxZoom) {
261+
dr = maxZoom / pdfView.getZoom();
260262
}
261263
pdfView.zoomCenteredRelativeTo(dr, new PointF(detector.getFocusX(), detector.getFocusY()));
262264
return true;

0 commit comments

Comments
 (0)