mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-10 02:05:37 +02:00
Avoid doing unnecessary work in AnnotationLayerBuilder.render
, such as cloning a PageViewport
, when no annotations exist for a page
This commit is contained in:
parent
346afd1e1c
commit
95bfc43a3b
1 changed files with 3 additions and 3 deletions
|
@ -66,6 +66,9 @@ class AnnotationLayerBuilder {
|
||||||
if (this._cancelled) {
|
if (this._cancelled) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (annotations.length === 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const parameters = {
|
const parameters = {
|
||||||
viewport: viewport.clone({ dontFlip: true }),
|
viewport: viewport.clone({ dontFlip: true }),
|
||||||
|
@ -86,9 +89,6 @@ class AnnotationLayerBuilder {
|
||||||
} else {
|
} else {
|
||||||
// Create an annotation layer div and render the annotations
|
// Create an annotation layer div and render the annotations
|
||||||
// if there is at least one annotation.
|
// if there is at least one annotation.
|
||||||
if (annotations.length === 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.div = document.createElement("div");
|
this.div = document.createElement("div");
|
||||||
this.div.className = "annotationLayer";
|
this.div.className = "annotationLayer";
|
||||||
this.pageDiv.appendChild(this.div);
|
this.pageDiv.appendChild(this.div);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue