mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-19 14:48:08 +02:00
Ensure that a document is loaded in PDFViewer.{increaseScale, decreaseScale}
(PR 14053 follow-up)
This was always "wrong", since these methods (just like all the zoom-related ones) don't make sense unless there's an active document.
This commit is contained in:
parent
9f50b0af37
commit
0860a5b168
1 changed files with 6 additions and 0 deletions
|
@ -2001,6 +2001,9 @@ class PDFViewer {
|
|||
* @param {Object|null} [options]
|
||||
*/
|
||||
increaseScale(steps = 1, options = null) {
|
||||
if (!this.pdfDocument) {
|
||||
return;
|
||||
}
|
||||
let newScale = this._currentScale;
|
||||
do {
|
||||
newScale = (newScale * DEFAULT_SCALE_DELTA).toFixed(2);
|
||||
|
@ -2019,6 +2022,9 @@ class PDFViewer {
|
|||
* @param {Object|null} [options]
|
||||
*/
|
||||
decreaseScale(steps = 1, options = null) {
|
||||
if (!this.pdfDocument) {
|
||||
return;
|
||||
}
|
||||
let newScale = this._currentScale;
|
||||
do {
|
||||
newScale = (newScale / DEFAULT_SCALE_DELTA).toFixed(2);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue