Don't use a hidden canvas when constructing the zoomLayer in PDFPageView.update

*This is an existing issue that I noticed while testing PR 8552.*

When zooming or rotation occurs, we'll try to use the current canvas as a (CSS transformed) preview until the page has been completely re-drawn.
If you manage to change the scale (or rotation) *very* quickly, it's possible that `PDFPageView.update` can be called *before* a previous `render` operation has progressed far enough to remove the `hidden` property from the canvas.

The result is thus that a page may be *entirely* black during zooming or rotation, which doesn't look very good. This effect can be a bit difficult to spot, but it does manifest even in the default viewer.
This commit is contained in:
Jonas Jenwald 2017-06-22 09:53:03 +02:00
parent 36fb3686cc
commit 426e26c63b

View File

@ -230,7 +230,7 @@ class PDFPageView {
}); });
return; return;
} }
if (!this.zoomLayer) { if (!this.zoomLayer && !this.canvas.hasAttribute('hidden')) {
this.zoomLayer = this.canvas.parentNode; this.zoomLayer = this.canvas.parentNode;
this.zoomLayer.style.position = 'absolute'; this.zoomLayer.style.position = 'absolute';
} }