File tree Expand file tree Collapse file tree 1 file changed +2
-5
lines changed
app/src/core/service/dataManageService/dragFileIntoStageEngine Expand file tree Collapse file tree 1 file changed +2
-5
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import { readFile } from "@tauri-apps/plugin-fs";
44import { CollisionBox } from "@/core/stage/stageObject/collisionBox/collisionBox" ;
55import { ImageNode } from "@/core/stage/stageObject/entity/ImageNode" ;
66import { Rectangle } from "@graphif/shapes" ;
7+ import { toast } from "sonner" ;
78
89/**
910 * 处理文件拖拽到舞台的引擎
@@ -26,15 +27,12 @@ export namespace DragFileIntoStageEngine {
2627
2728 // 使用Tauri的文件系统API读取文件内容
2829 const fileData = await readFile ( filePath ) ;
29- console . log ( `读取文件成功: ${ filePath } , 大小: ${ fileData . length } bytes` ) ;
3030
3131 // 创建Blob对象
3232 const blob = new Blob ( [ fileData ] , { type : "image/png" } ) ;
33- console . log ( `创建Blob成功: ${ blob . size } bytes, type: ${ blob . type } ` ) ;
3433
3534 // 添加到项目的attachments中
3635 const attachmentId = project . addAttachment ( blob ) ;
37- console . log ( `添加附件成功, ID: ${ attachmentId } ` ) ;
3836
3937 // 创建ImageNode并添加到舞台
4038 const imageNode = new ImageNode ( project , {
@@ -45,10 +43,9 @@ export namespace DragFileIntoStageEngine {
4543 } ) ;
4644
4745 project . stageManager . add ( imageNode ) ;
48- console . log ( `创建ImageNode成功并添加到舞台, UUID: ${ imageNode . uuid } ` ) ;
4946 }
5047 } catch ( error ) {
51- console . error ( `处理拖拽文件失败: ${ error instanceof Error ? error . message : String ( error ) } ` ) ;
48+ toast . error ( `处理拖拽文件失败: ${ error instanceof Error ? error . message : String ( error ) } ` ) ;
5249 }
5350 }
5451}
You can’t perform that action at this time.
0 commit comments