Merge pull request #15720 from Snuffleupagus/issue-15695
Ensure that the initial document position is always correct with non-default Scroll/Spread modes (issue 15695)
This commit is contained in:
commit
0766898d5d
@ -1023,10 +1023,12 @@ class PDFViewer {
|
|||||||
#scrollIntoView(pageView, pageSpot = null) {
|
#scrollIntoView(pageView, pageSpot = null) {
|
||||||
const { div, id } = pageView;
|
const { div, id } = pageView;
|
||||||
|
|
||||||
if (this._scrollMode === ScrollMode.PAGE) {
|
// Ensure that `this._currentPageNumber` is correct, when `#scrollIntoView`
|
||||||
// Ensure that `this._currentPageNumber` is correct.
|
// is called directly (and not from `#resetCurrentPageView`).
|
||||||
|
if (this._currentPageNumber !== id) {
|
||||||
this._setCurrentPageNumber(id);
|
this._setCurrentPageNumber(id);
|
||||||
|
}
|
||||||
|
if (this._scrollMode === ScrollMode.PAGE) {
|
||||||
this.#ensurePageViewVisible();
|
this.#ensurePageViewVisible();
|
||||||
// Ensure that rendering always occurs, to avoid showing a blank page,
|
// Ensure that rendering always occurs, to avoid showing a blank page,
|
||||||
// even if the current position doesn't change when the page is scrolled.
|
// even if the current position doesn't change when the page is scrolled.
|
||||||
@ -1046,6 +1048,15 @@ class PDFViewer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
scrollIntoView(div, pageSpot);
|
scrollIntoView(div, pageSpot);
|
||||||
|
|
||||||
|
// Ensure that the correct *initial* document position is set, when any
|
||||||
|
// OpenParameters are used, for documents with non-default Scroll/Spread
|
||||||
|
// modes (fixes issue 15695). This is necessary since the scroll-handler
|
||||||
|
// invokes the `update`-method asynchronously, and `this._location` could
|
||||||
|
// thus be wrong when the initial zooming occurs in the default viewer.
|
||||||
|
if (!this._currentScaleValue && this._location) {
|
||||||
|
this._location = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user