Skip to content

Commit 0b1bdae

Browse files
committed
fix: calculateBackgroundRendering may return width or height less than 1 #2982
1 parent 9691d6a commit 0b1bdae

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/render/background.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export const calculateBackgroundRendering = (
5858
backgroundPositioningArea
5959
);
6060

61-
const [sizeWidth, sizeHeight] = backgroundImageSize;
61+
let [sizeWidth, sizeHeight] = backgroundImageSize;
6262

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

80+
sizeWidth = Math.max(1, sizeWidth);
81+
sizeHeight = Math.max(1, sizeHeight);
82+
8083
return [path, offsetX, offsetY, sizeWidth, sizeHeight];
8184
};
8285

0 commit comments

Comments
 (0)