Skip to content

Commit

Permalink
[BUGFIX]
Browse files Browse the repository at this point in the history
added fix from niklasvh#2982
Added prepare script.
  • Loading branch information
Nicolas D'Amours committed Nov 9, 2023
1 parent 6020386 commit 4f767a6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion package.json
Expand Up @@ -113,7 +113,8 @@
"karma": "ts-node tests/karma",
"watch": "rollup -c rollup.config.ts -w",
"watch:unittest": "mocha --require ts-node/register --watch-extensions ts -w src/**/__tests__/*.ts",
"start": "ts-node tests/server --port=8080 --cors=8081"
"start": "ts-node tests/server --port=8080 --cors=8081",
"prepare": "npm run build"
},
"homepage": "https://html2canvas.hertzen.com",
"license": "MIT",
Expand Down
5 changes: 4 additions & 1 deletion src/render/background.ts
Expand Up @@ -58,7 +58,7 @@ export const calculateBackgroundRendering = (
backgroundPositioningArea
);

const [sizeWidth, sizeHeight] = backgroundImageSize;
let [sizeWidth, sizeHeight] = backgroundImageSize;

const position = getAbsoluteValueForTuple(
getBackgroundValueForIndex(container.styles.backgroundPosition, index),
Expand All @@ -77,6 +77,9 @@ export const calculateBackgroundRendering = (
const offsetX = Math.round(backgroundPositioningArea.left + position[0]);
const offsetY = Math.round(backgroundPositioningArea.top + position[1]);

sizeWidth = Math.max(1,sizeWidth)
sizeHeight = Math.max(1,sizeHeight)

return [path, offsetX, offsetY, sizeWidth, sizeHeight];
};

Expand Down

0 comments on commit 4f767a6

Please sign in to comment.