Skip to content

Commit

Permalink
Merge pull request #5989 from Snuffleupagus/updateviewarea-location
Browse files Browse the repository at this point in the history
Add the |location| to the |updateviewarea| UI event
  • Loading branch information
timvandermeij committed May 14, 2015
2 parents 67816bd + ba0eb7f commit 39d5031
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
13 changes: 7 additions & 6 deletions web/pdf_viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ var PDFViewer = (function pdfViewer() {
this._currentScale = UNKNOWN_SCALE;
this._currentScaleValue = null;
this._buffer = new PDFPageViewBuffer(DEFAULT_CACHE_SIZE);
this.location = null;
this._location = null;
this._pagesRotation = 0;
this._pagesRequests = [];

Expand Down Expand Up @@ -374,11 +374,11 @@ var PDFViewer = (function pdfViewer() {

if (!noScroll) {
var page = this._currentPageNumber, dest;
if (this.location && !IGNORE_CURRENT_POSITION_ON_ZOOM &&
if (this._location && !IGNORE_CURRENT_POSITION_ON_ZOOM &&
!(this.isInPresentationMode || this.isChangingPresentationMode)) {
page = this.location.pageNumber;
dest = [null, { name: 'XYZ' }, this.location.left,
this.location.top, null];
page = this._location.pageNumber;
dest = [null, { name: 'XYZ' }, this._location.left,
this._location.top, null];
}
this.scrollPageIntoView(page, dest);
}
Expand Down Expand Up @@ -557,7 +557,7 @@ var PDFViewer = (function pdfViewer() {
var intTop = Math.round(topLeft[1]);
pdfOpenParams += ',' + intLeft + ',' + intTop;

this.location = {
this._location = {
pageNumber: pageNumber,
scale: normalizedScaleValue,
top: intTop,
Expand Down Expand Up @@ -611,6 +611,7 @@ var PDFViewer = (function pdfViewer() {

var event = document.createEvent('UIEvents');
event.initUIEvent('updateviewarea', true, true, window, 0);
event.location = this._location;
this.container.dispatchEvent(event);
},

Expand Down
5 changes: 2 additions & 3 deletions web/viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down

0 comments on commit 39d5031

Please sign in to comment.