Skip to content

Commit

Permalink
do not reset scroll after page change
Browse files Browse the repository at this point in the history
  • Loading branch information
octocorvus committed Sep 7, 2024
1 parent 310c12f commit da94092
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions viewer/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,12 @@ function doPrerender(pageNumber, prerenderTrigger) {
}
}

function display(newCanvas, zoom) {
function display(newCanvas) {
canvas.height = newCanvas.height;
canvas.width = newCanvas.width;
canvas.style.height = newCanvas.style.height;
canvas.style.width = newCanvas.style.width;
canvas.getContext("2d", { alpha: false }).drawImage(newCanvas, 0, 0);
if (!zoom) {
scrollTo(0, 0);
}
}

function setLayerTransform(pageWidth, pageHeight, layerDiv) {
Expand Down Expand Up @@ -101,7 +98,7 @@ function renderPage(pageNumber, zoom, prerender, prerenderTrigger=0) {
cache.splice(i, 1);
cache.push(cached);

display(cached.canvas, zoom);
display(cached.canvas);

textLayerDiv.replaceWith(cached.textLayerDiv);
textLayerDiv = cached.textLayerDiv;
Expand Down Expand Up @@ -179,7 +176,7 @@ function renderPage(pageNumber, zoom, prerender, prerenderTrigger=0) {
if (!useRender || rendered) {
return;
}
display(newCanvas, zoom);
display(newCanvas);
rendered = true;
}
render();
Expand Down

0 comments on commit da94092

Please sign in to comment.