diff --git a/src/tiny-image-editor/src/components/Download.tsx b/src/tiny-image-editor/src/components/Download.tsx index 5d72faa3cc72f35e0e39b211cffe198bda56e03b..e8a1e44086ca66afba111592453a337e63e86364 100644 --- a/src/tiny-image-editor/src/components/Download.tsx +++ b/src/tiny-image-editor/src/components/Download.tsx @@ -18,7 +18,7 @@ const useDownload = () => { const { canvasInstanceRef, canvasEl, onDownLoad } = useContext(EditorContext); const handleDownload = (auto: boolean = false) => { - console.log('heheh'); + const canvas = canvasInstanceRef.current; @@ -65,6 +65,9 @@ const useDownload = () => { if(object.type === 'arrow'){ annotation.pointList=[object.x1, object.y1, object.x2, object.y2] } + if(object.type === 'path'){ + annotation.path = object.path + } annotations.push(annotation); }) // 打印标注信息 diff --git a/src/tiny-image-editor/src/components/Upload.tsx b/src/tiny-image-editor/src/components/Upload.tsx index c4ec8dbb6757b63e2b2b5a8c0c0002d2b9cb90e7..5275c2271896acf027de01903314e4eee5892c8f 100644 --- a/src/tiny-image-editor/src/components/Upload.tsx +++ b/src/tiny-image-editor/src/components/Upload.tsx @@ -65,6 +65,14 @@ function annotationsInit(annotations,canvas,historyRef){ }); newObject.strokeUniform = true; break; + case 'path' : + newObject = new fabric.Path(annotation.path, { + fill: annotation.fill, + stroke: annotation.stroke, + strokeWidth: annotation.size, + opacity: annotation.opacity || 1 + }); + break; // 可以根据需要添加更多元素类型的处理 }