[Regression] Ensure that pre-rendering of the next/previous page works correctly in Presentation Mode, when horizontal scrolling was enabled
Note how in `BaseViewer.forceRendering` the Scroll mode is used to determine how pre-rendering will work. Currently this is broken in Presentation Mode, if horizontal scrolling was enabled prior to entering fullscreen. Furthermore, there's a few additional cases where the `this.scrollMode === ScrollMode.HORIZONTAL` check is pointless either in Presentation Mode or when a `PDFSinglePageViewer` instance is used.
This commit is contained in:
parent
6a086fa0b9
commit
05f682cd4b
@ -597,11 +597,11 @@ class BaseViewer {
|
|||||||
if (!currentPage) {
|
if (!currentPage) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let hPadding = (this.isInPresentationMode || this.removePageBorders) ?
|
const noPadding = (this.isInPresentationMode || this.removePageBorders);
|
||||||
0 : SCROLLBAR_PADDING;
|
let hPadding = noPadding ? 0 : SCROLLBAR_PADDING;
|
||||||
let vPadding = (this.isInPresentationMode || this.removePageBorders) ?
|
let vPadding = noPadding ? 0 : VERTICAL_PADDING;
|
||||||
0 : VERTICAL_PADDING;
|
|
||||||
if (this.scrollMode === ScrollMode.HORIZONTAL) {
|
if (!noPadding && this._isScrollModeHorizontal) {
|
||||||
const temp = hPadding;
|
const temp = hPadding;
|
||||||
hPadding = vPadding;
|
hPadding = vPadding;
|
||||||
vPadding = temp;
|
vPadding = temp;
|
||||||
@ -834,6 +834,10 @@ class BaseViewer {
|
|||||||
this.container.focus();
|
this.container.focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get _isScrollModeHorizontal() {
|
||||||
|
throw new Error('Not implemented: _isScrollModeHorizontal');
|
||||||
|
}
|
||||||
|
|
||||||
get isInPresentationMode() {
|
get isInPresentationMode() {
|
||||||
return this.presentationModeState === PresentationModeState.FULLSCREEN;
|
return this.presentationModeState === PresentationModeState.FULLSCREEN;
|
||||||
}
|
}
|
||||||
@ -906,8 +910,8 @@ class BaseViewer {
|
|||||||
|
|
||||||
forceRendering(currentlyVisiblePages) {
|
forceRendering(currentlyVisiblePages) {
|
||||||
let visiblePages = currentlyVisiblePages || this._getVisiblePages();
|
let visiblePages = currentlyVisiblePages || this._getVisiblePages();
|
||||||
let scrollAhead = this.scrollMode === ScrollMode.HORIZONTAL ?
|
let scrollAhead = (this._isScrollModeHorizontal ?
|
||||||
this.scroll.right : this.scroll.down;
|
this.scroll.right : this.scroll.down);
|
||||||
let pageView = this.renderingQueue.getHighestPriority(visiblePages,
|
let pageView = this.renderingQueue.getHighestPriority(visiblePages,
|
||||||
this._pages,
|
this._pages,
|
||||||
scrollAhead);
|
scrollAhead);
|
||||||
|
@ -142,6 +142,11 @@ class PDFSinglePageViewer extends BaseViewer {
|
|||||||
location: this._location,
|
location: this._location,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get _isScrollModeHorizontal() {
|
||||||
|
// The Scroll/Spread modes are never used in `PDFSinglePageViewer`.
|
||||||
|
return shadow(this, '_isScrollModeHorizontal', false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export {
|
export {
|
||||||
|
@ -23,7 +23,7 @@ class PDFViewer extends BaseViewer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_scrollIntoView({ pageDiv, pageSpot = null, }) {
|
_scrollIntoView({ pageDiv, pageSpot = null, }) {
|
||||||
if (!pageSpot) {
|
if (!pageSpot && !this.isInPresentationMode) {
|
||||||
const left = pageDiv.offsetLeft + pageDiv.clientLeft;
|
const left = pageDiv.offsetLeft + pageDiv.clientLeft;
|
||||||
const right = left + pageDiv.clientWidth;
|
const right = left + pageDiv.clientWidth;
|
||||||
const { scrollLeft, clientWidth, } = this.container;
|
const { scrollLeft, clientWidth, } = this.container;
|
||||||
@ -87,6 +87,13 @@ class PDFViewer extends BaseViewer {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get _isScrollModeHorizontal() {
|
||||||
|
// Used to ensure that pre-rendering of the next/previous page works
|
||||||
|
// correctly, since Scroll/Spread modes are ignored in Presentation Mode.
|
||||||
|
return (this.isInPresentationMode ?
|
||||||
|
false : this.scrollMode === ScrollMode.HORIZONTAL);
|
||||||
|
}
|
||||||
|
|
||||||
setScrollMode(mode) {
|
setScrollMode(mode) {
|
||||||
if (mode === this.scrollMode) {
|
if (mode === this.scrollMode) {
|
||||||
return;
|
return;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user