@@ -1023,10 +1023,12 @@ class PDFViewer {
10231023 #scrollIntoView( pageView , pageSpot = null ) {
10241024 const { div, id } = pageView ;
10251025
1026- if ( this . _scrollMode === ScrollMode . PAGE ) {
1027- // Ensure that `this._currentPageNumber` is correct.
1026+ // Ensure that `this._currentPageNumber` is correct, when `#scrollIntoView`
1027+ // is called directly (and not from `#resetCurrentPageView`).
1028+ if ( this . _currentPageNumber !== id ) {
10281029 this . _setCurrentPageNumber ( id ) ;
1029-
1030+ }
1031+ if ( this . _scrollMode === ScrollMode . PAGE ) {
10301032 this . #ensurePageViewVisible( ) ;
10311033 // Ensure that rendering always occurs, to avoid showing a blank page,
10321034 // even if the current position doesn't change when the page is scrolled.
@@ -1046,6 +1048,15 @@ class PDFViewer {
10461048 }
10471049 }
10481050 scrollIntoView ( div , pageSpot ) ;
1051+
1052+ // Ensure that the correct *initial* document position is set, when any
1053+ // OpenParameters are used, for documents with non-default Scroll/Spread
1054+ // modes (fixes issue 15695). This is necessary since the scroll-handler
1055+ // invokes the `update`-method asynchronously, and `this._location` could
1056+ // thus be wrong when the initial zooming occurs in the default viewer.
1057+ if ( ! this . _currentScaleValue && this . _location ) {
1058+ this . _location = null ;
1059+ }
10491060 }
10501061
10511062 /**
0 commit comments