Skip to content

Commit

Permalink
Merge pull request #19206 from nicolo-ribaudo/canvas-prepend
Browse files Browse the repository at this point in the history
Simplify logic to insert canvas as first element
  • Loading branch information
calixteman authored Dec 10, 2024
2 parents 44421d3 + 62db66d commit aa589b9
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions web/pdf_page_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -989,12 +989,7 @@ class PDFPageView {
// drawing is complete when `!this.renderingQueue`, to prevent black
// flickering.
// In whatever case, the canvas must be the first child.
const { firstChild } = canvasWrapper;
if (firstChild) {
firstChild.before(canvas);
} else {
canvasWrapper.append(canvas);
}
canvasWrapper.prepend(canvas);
showCanvas = null;
return;
}
Expand All @@ -1006,12 +1001,7 @@ class PDFPageView {
prevCanvas.replaceWith(canvas);
prevCanvas.width = prevCanvas.height = 0;
} else {
const { firstChild } = canvasWrapper;
if (firstChild) {
firstChild.before(canvas);
} else {
canvasWrapper.append(canvas);
}
canvasWrapper.prepend(canvas);
}

showCanvas = null;
Expand Down

0 comments on commit aa589b9

Please sign in to comment.