Add support for setting multiple values at once in ViewHistory
This commit is contained in:
parent
48399a3ec7
commit
69eafaa58f
@ -113,6 +113,16 @@ var ViewHistory = (function ViewHistoryClosure() {
|
|||||||
this._writeToStorage();
|
this._writeToStorage();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
setMultiple: function ViewHistory_setMultiple(properties) {
|
||||||
|
if (!this.isInitializedPromiseResolved) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for (var name in properties) {
|
||||||
|
this.file[name] = properties[name];
|
||||||
|
}
|
||||||
|
this._writeToStorage();
|
||||||
|
},
|
||||||
|
|
||||||
get: function ViewHistory_get(name, defaultValue) {
|
get: function ViewHistory_get(name, defaultValue) {
|
||||||
if (!this.isInitializedPromiseResolved) {
|
if (!this.isInitializedPromiseResolved) {
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
|
@ -1970,13 +1970,14 @@ function updateViewarea() {
|
|||||||
PDFView.currentPosition = { page: pageNumber, left: intLeft, top: intTop };
|
PDFView.currentPosition = { page: pageNumber, left: intLeft, top: intTop };
|
||||||
}
|
}
|
||||||
|
|
||||||
var store = PDFView.store;
|
PDFView.store.initializedPromise.then(function() {
|
||||||
store.initializedPromise.then(function() {
|
PDFView.store.setMultiple({
|
||||||
store.set('exists', true);
|
'exists': true,
|
||||||
store.set('page', pageNumber);
|
'page': pageNumber,
|
||||||
store.set('zoom', normalizedScaleValue);
|
'zoom': normalizedScaleValue,
|
||||||
store.set('scrollLeft', intLeft);
|
'scrollLeft': intLeft,
|
||||||
store.set('scrollTop', intTop);
|
'scrollTop': intTop
|
||||||
|
});
|
||||||
});
|
});
|
||||||
var href = PDFView.getAnchorUrl(pdfOpenParams);
|
var href = PDFView.getAnchorUrl(pdfOpenParams);
|
||||||
document.getElementById('viewBookmark').href = href;
|
document.getElementById('viewBookmark').href = href;
|
||||||
|
Loading…
Reference in New Issue
Block a user