Merge pull request #16507 from Snuffleupagus/zooming-regressions-2

Fix more regressions from PR 15812
This commit is contained in:
Jonas Jenwald 2023-06-02 09:26:09 +02:00 committed by GitHub
commit 6b16d903b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -125,6 +125,7 @@ class PDFPageView {
#textLayerMode = TextLayerMode.ENABLE;
#useThumbnailCanvas = {
directDrawing: true,
initialOptionalContent: true,
regularAnnotations: true,
};
@ -552,6 +553,7 @@ class PDFPageView {
optionalContentConfig.hasInitialVisibility;
});
}
this.#useThumbnailCanvas.directDrawing = true;
const totalRotation = (this.rotation + this.pdfPageRotate) % 360;
this.viewport = this.viewport.clone({
@ -605,6 +607,9 @@ class PDFPageView {
// the rendering state to INITIAL, hence the next call to
// PDFViewer.update() will trigger a redraw (if it's mandatory).
this.renderingState = RenderingStates.FINISHED;
// Ensure that the thumbnails won't become partially (or fully) blank,
// if the sidebar is opened before the actual rendering is done.
this.#useThumbnailCanvas.directDrawing = false;
}
this.cssTransform({
@ -616,6 +621,11 @@ class PDFPageView {
hideTextLayer: postponeDrawing,
});
if (postponeDrawing) {
// The "pagerendered"-event will be dispatched once the actual
// rendering is done, hence don't dispatch it here as well.
return;
}
this.eventBus.dispatch("pagerendered", {
source: this,
pageNumber: this.id,
@ -1028,9 +1038,11 @@ class PDFPageView {
* @ignore
*/
get thumbnailCanvas() {
const { initialOptionalContent, regularAnnotations } =
const { directDrawing, initialOptionalContent, regularAnnotations } =
this.#useThumbnailCanvas;
return initialOptionalContent && regularAnnotations ? this.canvas : null;
return directDrawing && initialOptionalContent && regularAnnotations
? this.canvas
: null;
}
}