diff --git a/package.json b/package.json index cefd4369a..901ac4943 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/render/background.ts b/src/render/background.ts index 6e0e877ea..dd92d171a 100644 --- a/src/render/background.ts +++ b/src/render/background.ts @@ -58,7 +58,7 @@ export const calculateBackgroundRendering = ( backgroundPositioningArea ); - const [sizeWidth, sizeHeight] = backgroundImageSize; + let [sizeWidth, sizeHeight] = backgroundImageSize; const position = getAbsoluteValueForTuple( getBackgroundValueForIndex(container.styles.backgroundPosition, index), @@ -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]; };