[Pkg-javascript-commits] [pdf.js] 24/157: Make sure that the document is rendered on zooming and rotation for `PDFViewer` instances using the `defaultRenderingQueue`
David Prévot
taffit at moszumanska.debian.org
Tue Aug 11 06:46:29 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository pdf.js.
commit d940078d955dc3e2a6d07953adad09372502963e
Author: Jonas Jenwald <jonas.jenwald at gmail.com>
Date: Tue Jun 30 21:49:32 2015 +0200
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.
---
web/pdf_viewer.js | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/web/pdf_viewer.js b/web/pdf_viewer.js
index 75dcf32..e3f813f 100644
--- a/web/pdf_viewer.js
+++ b/web/pdf_viewer.js
@@ -205,6 +205,10 @@ var PDFViewer = (function pdfViewer() {
}
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) {
return;
}
@@ -390,6 +394,10 @@ var PDFViewer = (function pdfViewer() {
}
this._setScaleDispatchEvent(newScale, newValue, preset);
+
+ if (this.defaultRenderingQueue) {
+ this.update();
+ }
},
_setScale: function pdfViewer_setScale(value, noScroll) {
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/pdf.js.git
More information about the Pkg-javascript-commits
mailing list