Add the |location| to the |updateviewarea| UI event

*This patch addresses an issue I stumbled upon while working on rewriting the history implementation.*

Currently the `updateviewarea` UI event doesn't include the `location`, and in the event handler in viewer.js we instead reach into `PDFViewer` to retrieve it. Not only does this seem conceptually wrong, it also makes the `updateviewarea` event less useful in general since it's currently only possible to access the `location` if you have a reference to the `PDFViewer`.

To me, this simply appears to be an oversight in the implementation, hence this patch which adds `location` to the `updateviewarea` event. It also changes `location` to be a "private" property of `PDFViewer`.
This commit is contained in:
Jonas Jenwald 2015-05-08 11:48:07 +02:00
parent 6d2d854f65
commit ba0eb7fdc6
2 changed files with 9 additions and 9 deletions

View file

@ -1753,12 +1753,11 @@ function updateViewarea() {
PDFViewerApplication.pdfViewer.update();
}
window.addEventListener('updateviewarea', function () {
window.addEventListener('updateviewarea', function (evt) {
if (!PDFViewerApplication.initialized) {
return;
}
var location = PDFViewerApplication.pdfViewer.location;
var location = evt.location;
PDFViewerApplication.store.initializedPromise.then(function() {
PDFViewerApplication.store.setMultiple({