Prevent a temporary position from being added to the history while a destination is scrolled into view
Since e.g. zooming can occur when navigating to a new destionation, ensure that a resulting 'updateviewarea' event doesn't trigger adding of a *temporary* position to the browser history at a bad time.
This commit is contained in:
parent
077195d8ce
commit
b7c4d788ed
@ -189,6 +189,17 @@ class PDFHistory {
|
||||
hash,
|
||||
page: pageNumber,
|
||||
}, forceReplace);
|
||||
|
||||
if (!this._popStateInProgress) {
|
||||
// Prevent the browser history from updating while the new destination is
|
||||
// being scrolled into view, to avoid potentially inconsistent state.
|
||||
this._popStateInProgress = true;
|
||||
// We defer the resetting of `this._popStateInProgress`, to account for
|
||||
// e.g. zooming occuring when the new destination is being navigated to.
|
||||
Promise.resolve().then(() => {
|
||||
this._popStateInProgress = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user