Merge pull request #19868 from Snuffleupagus/MathClamp-4

Use the `MathClamp` helper function more in the `web/` folder (PR 19617 follow-up)
This commit is contained in:
Jonas Jenwald 2025-04-26 12:07:30 +02:00 committed by GitHub
commit c2d88540b4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -32,6 +32,7 @@ import {
AnnotationEditorType,
AnnotationEditorUIManager,
AnnotationMode,
MathClamp,
PermissionFlag,
PixelsPerInch,
shadow,
@ -2294,7 +2295,7 @@ class PDFViewer {
newScale = round((newScale * delta).toFixed(2) * 10) / 10;
} while (--steps > 0);
}
newScale = Math.max(MIN_SCALE, Math.min(MAX_SCALE, newScale));
newScale = MathClamp(newScale, MIN_SCALE, MAX_SCALE);
this.#setScale(newScale, { noScroll: false, drawingDelay, origin });
}