-
Notifications
You must be signed in to change notification settings - Fork 10k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed #5927 - Now remembers page rotation on reload #5949
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -198,7 +198,9 @@ var PDFViewer = (function pdfViewer() { | |
page.update(page.scale, rotation); | ||
} | ||
|
||
this._setScale(this._currentScaleValue, true); | ||
if (this._currentScale !== UNKNOWN_SCALE) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this change needed? |
||
this._setScale(this._currentScaleValue, true); | ||
} | ||
}, | ||
|
||
/** | ||
|
@@ -568,7 +570,8 @@ var PDFViewer = (function pdfViewer() { | |
scale: normalizedScaleValue, | ||
top: intTop, | ||
left: intLeft, | ||
pdfOpenParams: pdfOpenParams | ||
pdfOpenParams: pdfOpenParams, | ||
rotation: this._pagesRotation | ||
}; | ||
}, | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -901,6 +901,11 @@ var PDFViewerApplication = { | |
store.get('zoom', self.pdfViewer.currentScale); | ||
var left = store.get('scrollLeft', '0'); | ||
var top = store.get('scrollTop', '0'); | ||
var rotation = store.get('rotation', '0') | 0; | ||
|
||
if (rotation !== self.pageRotation) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The code has changed here a bit. Instead of calling this here, let's pass the rotation as an argument into setInitialView and then have setInitialView call rotatePages |
||
self.rotatePages(rotation, true); | ||
} | ||
|
||
storedHash = 'page=' + pageNum + '&zoom=' + zoom + ',' + | ||
left + ',' + top; | ||
|
@@ -1323,15 +1328,16 @@ var PDFViewerApplication = { | |
this.updateScaleControls = true; | ||
}, | ||
|
||
rotatePages: function pdfViewRotatePages(delta) { | ||
rotatePages: function pdfViewRotatePages(delta, noRendering) { | ||
var pageNumber = this.page; | ||
this.pageRotation = (this.pageRotation + 360 + delta) % 360; | ||
this.pdfViewer.pagesRotation = this.pageRotation; | ||
this.pdfThumbnailViewer.pagesRotation = this.pageRotation; | ||
|
||
this.forceRendering(); | ||
|
||
this.pdfViewer.scrollPageIntoView(pageNumber); | ||
if (!noRendering) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I like to avoid double negatives when possible. How about we make a setRotation(delta) function that only updates values and then change rotatePages to call setRotation and the code in this 'if' statement. Then in setInitialView you just have to call setRotation(...) |
||
this.forceRendering(); | ||
this.pdfViewer.scrollPageIntoView(pageNumber); | ||
} | ||
}, | ||
|
||
/** | ||
|
@@ -1786,7 +1792,8 @@ window.addEventListener('updateviewarea', function () { | |
'page': location.pageNumber, | ||
'zoom': location.scale, | ||
'scrollLeft': location.left, | ||
'scrollTop': location.top | ||
'scrollTop': location.top, | ||
'rotation': location.rotation | ||
}).catch(function() { | ||
// unable to write to storage | ||
}); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change is unrelated to the patch, please revert it.