Browse Source

fix: rounded left and top clipped image export to SVG (#10387)

Remove clipPathUnits attribute from clipPath

Removed setting of clipPathUnits attribute for clipPath element.
pull/9235/merge
zsviczian 3 weeks ago committed by GitHub
parent
commit
d7e63e66a7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 6
      packages/excalidraw/renderer/staticSvgScene.ts

6
packages/excalidraw/renderer/staticSvgScene.ts

@ -541,7 +541,7 @@ const renderElementToSvg = ( @@ -541,7 +541,7 @@ const renderElementToSvg = (
"clipPath",
);
clipPath.id = `image-clipPath-${element.id}`;
clipPath.setAttribute("clipPathUnits", "userSpaceOnUse");
const clipRect = svgRoot.ownerDocument!.createElementNS(
SVG_NS,
"rect",
@ -550,6 +550,10 @@ const renderElementToSvg = ( @@ -550,6 +550,10 @@ const renderElementToSvg = (
Math.min(element.width, element.height),
element,
);
const clipOffsetX = element.crop ? normalizedCropX : 0;
const clipOffsetY = element.crop ? normalizedCropY : 0;
clipRect.setAttribute("x", `${clipOffsetX}`);
clipRect.setAttribute("y", `${clipOffsetY}`);
clipRect.setAttribute("width", `${element.width}`);
clipRect.setAttribute("height", `${element.height}`);
clipRect.setAttribute("rx", `${radius}`);

Loading…
Cancel
Save