mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
fix: replace view box with clip path for pdf and server exports
This commit is contained in:
parent
958e03fcc6
commit
ef037d3de8
1 changed files with 9 additions and 9 deletions
|
@ -424,17 +424,17 @@ const renderElementToSvg = (
|
||||||
if (element.crop) {
|
if (element.crop) {
|
||||||
const { width: uncroppedWidth, height: uncroppedHeight } =
|
const { width: uncroppedWidth, height: uncroppedHeight } =
|
||||||
getUncroppedWidthAndHeight(element);
|
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("width", `${uncroppedWidth}`);
|
||||||
image.setAttribute("height", `${uncroppedHeight}`);
|
image.setAttribute("height", `${uncroppedHeight}`);
|
||||||
|
|
||||||
|
image.setAttribute(
|
||||||
|
"transform",
|
||||||
|
`translate(${
|
||||||
|
-element.crop.x / (element.crop.naturalWidth / uncroppedWidth)
|
||||||
|
} ${
|
||||||
|
-element.crop.y / (element.crop.naturalHeight / uncroppedHeight)
|
||||||
|
})`,
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
image.setAttribute("width", "100%");
|
image.setAttribute("width", "100%");
|
||||||
image.setAttribute("height", "100%");
|
image.setAttribute("height", "100%");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue