mirror of
https://github.com/niklasvh/html2canvas.git
synced 2023-08-10 21:13:10 +03:00
fix: calculateBackgroundRendering may return width or height less than 1
This commit is contained in:
parent
6020386bbe
commit
2f2e96b6a2
@ -58,7 +58,7 @@ export const calculateBackgroundRendering = (
|
|||||||
backgroundPositioningArea
|
backgroundPositioningArea
|
||||||
);
|
);
|
||||||
|
|
||||||
const [sizeWidth, sizeHeight] = backgroundImageSize;
|
let [sizeWidth, sizeHeight] = backgroundImageSize;
|
||||||
|
|
||||||
const position = getAbsoluteValueForTuple(
|
const position = getAbsoluteValueForTuple(
|
||||||
getBackgroundValueForIndex(container.styles.backgroundPosition, index),
|
getBackgroundValueForIndex(container.styles.backgroundPosition, index),
|
||||||
@ -77,6 +77,9 @@ export const calculateBackgroundRendering = (
|
|||||||
const offsetX = Math.round(backgroundPositioningArea.left + position[0]);
|
const offsetX = Math.round(backgroundPositioningArea.left + position[0]);
|
||||||
const offsetY = Math.round(backgroundPositioningArea.top + position[1]);
|
const offsetY = Math.round(backgroundPositioningArea.top + position[1]);
|
||||||
|
|
||||||
|
sizeWidth = Math.max(1,sizeWidth)
|
||||||
|
sizeHeight = Math.max(1,sizeHeight)
|
||||||
|
|
||||||
return [path, offsetX, offsetY, sizeWidth, sizeHeight];
|
return [path, offsetX, offsetY, sizeWidth, sizeHeight];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user