mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-21 07:38:07 +02:00
Merge pull request #6318 from Snuffleupagus/bug-1191279
For documents with different page sizes, ensure that the correct page becomes visible on load when e.g. the 'page' hash parameter was provided (bug 1191279, issue 6393)
This commit is contained in:
commit
a4ca9986e1
1 changed files with 25 additions and 0 deletions
|
@ -865,6 +865,12 @@ var PDFViewerApplication = {
|
|||
}
|
||||
}
|
||||
|
||||
var initialParams = {
|
||||
destination: self.initialDestination,
|
||||
bookmark: self.initialBookmark,
|
||||
hash: null,
|
||||
};
|
||||
|
||||
store.initializedPromise.then(function resolved() {
|
||||
var storedHash = null;
|
||||
if (self.preferenceShowPreviousViewOnLoad &&
|
||||
|
@ -882,6 +888,8 @@ var PDFViewerApplication = {
|
|||
}
|
||||
self.setInitialView(storedHash, scale);
|
||||
|
||||
initialParams.hash = storedHash;
|
||||
|
||||
// Make all navigation keys work on document load,
|
||||
// unless the viewer is embedded in a web page.
|
||||
if (!self.isViewerEmbedded) {
|
||||
|
@ -891,6 +899,23 @@ var PDFViewerApplication = {
|
|||
console.error(reason);
|
||||
self.setInitialView(null, scale);
|
||||
});
|
||||
|
||||
// For documents with different page sizes,
|
||||
// ensure that the correct location becomes visible on load.
|
||||
pagesPromise.then(function resolved() {
|
||||
if (!initialParams.destination && !initialParams.bookmark &&
|
||||
!initialParams.hash) {
|
||||
return;
|
||||
}
|
||||
if (self.hasEqualPageSizes) {
|
||||
return;
|
||||
}
|
||||
self.initialDestination = initialParams.destination;
|
||||
self.initialBookmark = initialParams.bookmark;
|
||||
|
||||
self.pdfViewer.currentScaleValue = self.pdfViewer.currentScaleValue;
|
||||
self.setInitialView(initialParams.hash, scale);
|
||||
});
|
||||
});
|
||||
|
||||
pagesPromise.then(function() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue