mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 01:10:08 +02:00
Don't allow setting various properties, such as currentPageNumber
/currentScale
/currentScaleValue
/pagesRotation
, before {PDFViewer, PDFThumbnailViewer}.setDocument
has been called
Currently a number of these properties do not work correctly if set *before* calling `setDocument`; please refer to the discussion starting in https://github.com/mozilla/pdf.js/pull/8539#issuecomment-309706629. Rather than trying to have *some* of these methods working, but not others, it seems much more consistent to simply always require that `setDocument` has been called.
This commit is contained in:
parent
9bed695ebd
commit
735b58c3d5
2 changed files with 14 additions and 12 deletions
|
@ -95,8 +95,15 @@ class PDFThumbnailViewer {
|
|||
}
|
||||
|
||||
set pagesRotation(rotation) {
|
||||
if (!(typeof rotation === 'number' && rotation % 90 === 0)) {
|
||||
throw new Error('Invalid thumbnails rotation angle.');
|
||||
}
|
||||
if (!this.pdfDocument) {
|
||||
return;
|
||||
}
|
||||
this._pagesRotation = rotation;
|
||||
for (let i = 0, l = this._thumbnails.length; i < l; i++) {
|
||||
|
||||
for (let i = 0, ii = this._thumbnails.length; i < ii; i++) {
|
||||
this._thumbnails[i].update(rotation);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue