소스 검색

fix: normalizeSVG width and height from viewbox when size includes decimal points (#8939)

Update image.ts
zsviczian 9 달 전
부모
커밋
56fca30bd0
1개의 변경된 파일3개의 추가작업 그리고 1개의 파일을 삭제
  1. 3 1
      packages/excalidraw/element/image.ts

+ 3 - 1
packages/excalidraw/element/image.ts

@@ -124,7 +124,9 @@ export const normalizeSVG = (SVGString: string) => {
       height = height || "50";
 
       if (viewBox) {
-        const match = viewBox.match(/\d+ +\d+ +(\d+) +(\d+)/);
+        const match = viewBox.match(
+          /\d+ +\d+ +(\d+(?:\.\d+)?) +(\d+(?:\.\d+)?)/,
+        );
         if (match) {
           [, width, height] = match;
         }