Skip to content

Commit

Permalink
Merge pull request #12 from yorickshan/fix/2982
Browse files Browse the repository at this point in the history
fix: calculateBackgroundRendering may return width or height less tha…
  • Loading branch information
yorickshan authored Jul 8, 2024
2 parents 9691d6a + 0b1bdae commit 37ae5f5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/render/background.ts
Original file line number Diff line number Diff line change
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 37ae5f5

Please sign in to comment.