Remove the BaseViewer._getCurrentVisiblePage
helper method
This method was originally added specifically to work-around bugs/issues related to PresentationMode in Google Chrome. Note that prior to PR 14112 we were using some CSS hacks to only show the current page in PresentationMode, and that could lead to the `getVisibleElements` function not always finding the correct elements. However, after the changes in PR 14112 we're now using the Page-scrolling mode in PresentationMode and consequently there'll only be *a single* page visible at a time. Hence then `BaseViewer._getCurrentVisiblePage` helper method should no longer be needed, and when testing (locally) in Google Chrome everything seems to work correctly now.
This commit is contained in:
parent
27e738dff9
commit
5ef294b3a7
@ -1418,37 +1418,7 @@ class BaseViewer {
|
||||
: this.container.scrollHeight > this.container.clientHeight;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method for `this._getVisiblePages`. Should only ever be used when
|
||||
* the viewer can only display a single page at a time, for example:
|
||||
* - When PresentationMode is active.
|
||||
*/
|
||||
_getCurrentVisiblePage() {
|
||||
if (!this.pagesCount) {
|
||||
return { views: [] };
|
||||
}
|
||||
const pageView = this._pages[this._currentPageNumber - 1];
|
||||
// NOTE: Compute the `x` and `y` properties of the current view,
|
||||
// since `this._updateLocation` depends of them being available.
|
||||
const element = pageView.div;
|
||||
|
||||
const view = {
|
||||
id: pageView.id,
|
||||
x: element.offsetLeft + element.clientLeft,
|
||||
y: element.offsetTop + element.clientTop,
|
||||
view: pageView,
|
||||
};
|
||||
const ids = new Set([pageView.id]);
|
||||
|
||||
return { first: view, last: view, views: [view], ids };
|
||||
}
|
||||
|
||||
_getVisiblePages() {
|
||||
if (this.isInPresentationMode) {
|
||||
// The algorithm in `getVisibleElements` doesn't work in all browsers and
|
||||
// configurations (e.g. Chrome) when PresentationMode is active.
|
||||
return this._getCurrentVisiblePage();
|
||||
}
|
||||
const views =
|
||||
this._scrollMode === ScrollMode.PAGE
|
||||
? this.#scrollModePageState.pages
|
||||
|
Loading…
x
Reference in New Issue
Block a user