From cac48b2accc7d92b5cf76450cfab26c8b5f73c15 Mon Sep 17 00:00:00 2001 From: qq_41923622 Date: Thu, 6 Feb 2025 13:55:00 +0800 Subject: [PATCH] Thu Feb 6 13:55:00 CST 2025 inscode --- src/tiny-image-editor/src/components/Download.tsx | 5 ++++- src/tiny-image-editor/src/components/Upload.tsx | 8 ++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/tiny-image-editor/src/components/Download.tsx b/src/tiny-image-editor/src/components/Download.tsx index 5d72faa..e8a1e44 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 c4ec8db..5275c22 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; // 可以根据需要添加更多元素类型的处理 } -- GitLab