mirror of
https://github.com/linkwarden/browser-extension.git
synced 2026-08-07 07:14:40 +00:00
bug fix
This commit is contained in:
+4
-12
@@ -153,18 +153,10 @@ async function captureFullPageScreenshot(): Promise<Blob> {
|
||||
tab.id,
|
||||
() => window.innerWidth
|
||||
)) as number;
|
||||
const devicePixelRatio = (await executeScript(
|
||||
tab.id,
|
||||
() => window.devicePixelRatio
|
||||
)) as number;
|
||||
|
||||
const fullPageBlobs: Blob[] = [];
|
||||
let scrollPosition = 0;
|
||||
|
||||
const scaledViewportHeight = viewportHeight * devicePixelRatio;
|
||||
const scaledViewportWidth = viewportWidth * devicePixelRatio;
|
||||
const scaledTotalHeight = totalHeight * devicePixelRatio;
|
||||
|
||||
while (scrollPosition < totalHeight) {
|
||||
await executeScript(tab.id, (pos: any) => window.scrollTo(0, pos), [
|
||||
scrollPosition,
|
||||
@@ -181,14 +173,14 @@ async function captureFullPageScreenshot(): Promise<Blob> {
|
||||
}
|
||||
|
||||
const canvas = document.createElement('canvas');
|
||||
canvas.width = scaledViewportWidth;
|
||||
canvas.height = scaledTotalHeight;
|
||||
canvas.width = viewportWidth;
|
||||
canvas.height = totalHeight;
|
||||
|
||||
const resultBlob = await drawImagesOnCanvas(
|
||||
canvas,
|
||||
fullPageBlobs,
|
||||
scaledViewportHeight,
|
||||
scaledTotalHeight
|
||||
viewportHeight,
|
||||
totalHeight
|
||||
);
|
||||
|
||||
await executeScript(tab.id, removeHideScrollbarClass);
|
||||
|
||||
Reference in New Issue
Block a user