Make sure that the document is rendered on zooming and rotation for PDFViewer
instances using the defaultRenderingQueue
In `viewer.js` we have code that ensures that the document is re-rendered on zooming and rotation. However, for `components` based viewers this might not work correctly, since there's currently no code which handles that. Note that there is a good chance that this "just works" in many `components` viewers already, thanks to the `watchScroll` function. The explanation is that zooming or rotation, most of the time, causes the viewer to change its (scrollable) size, thus triggering `PDFViewer_update` through `PDFViewer_scrollUpdate`. However, in general there's no guarantee that this will actually work (since zooming and rotation doesn't necessarily change the size of the viewer for all documents), and requiring every viewer `components` implementer to provide methods for this doesn't seem like a great idea.
This commit is contained in:
parent
1da0b3a363
commit
d940078d95
@ -205,6 +205,10 @@ var PDFViewer = (function pdfViewer() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this._setScale(this._currentScaleValue, true);
|
this._setScale(this._currentScaleValue, true);
|
||||||
|
|
||||||
|
if (this.defaultRenderingQueue) {
|
||||||
|
this.update();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -342,7 +346,7 @@ var PDFViewer = (function pdfViewer() {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_scrollUpdate: function () {
|
_scrollUpdate: function PDFViewer_scrollUpdate() {
|
||||||
if (this.pagesCount === 0) {
|
if (this.pagesCount === 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -390,6 +394,10 @@ var PDFViewer = (function pdfViewer() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this._setScaleDispatchEvent(newScale, newValue, preset);
|
this._setScaleDispatchEvent(newScale, newValue, preset);
|
||||||
|
|
||||||
|
if (this.defaultRenderingQueue) {
|
||||||
|
this.update();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_setScale: function pdfViewer_setScale(value, noScroll) {
|
_setScale: function pdfViewer_setScale(value, noScroll) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user