fix: replace view box with clip path for pdf and server exports

This commit is contained in:
Ryan Di 2024-10-24 15:39:19 +08:00
parent 958e03fcc6
commit ef037d3de8

View File

@ -424,17 +424,17 @@ const renderElementToSvg = (
if (element.crop) {
const { width: uncroppedWidth, height: uncroppedHeight } =
getUncroppedWidthAndHeight(element);
symbol.setAttribute(
"viewBox",
`${
element.crop.x / (element.crop.naturalWidth / uncroppedWidth)
} ${
element.crop.y / (element.crop.naturalHeight / uncroppedHeight)
} ${width} ${height}`,
);
image.setAttribute("width", `${uncroppedWidth}`);
image.setAttribute("height", `${uncroppedHeight}`);
image.setAttribute(
"transform",
`translate(${
-element.crop.x / (element.crop.naturalWidth / uncroppedWidth)
} ${
-element.crop.y / (element.crop.naturalHeight / uncroppedHeight)
})`,
);
} else {
image.setAttribute("width", "100%");
image.setAttribute("height", "100%");