@@ -10,6 +10,7 @@ import { cn } from "../../utils/cn";
1010import { StageManager } from "../../core/stage/stageManager/StageManager" ;
1111import { isMac } from "../../utils/platform" ;
1212import { writeFileBase64 } from "../../utils/fs" ;
13+ import { downloadDir } from "@tauri-apps/api/path" ;
1314
1415/**
1516 * 导出png的面板
@@ -44,7 +45,7 @@ export default function ExportPNGPanel() {
4445
4546 const [ cameraScaleWhenExport , setCameraScaleWhenExport ] = useState ( 0.5 ) ;
4647
47- const downloadImage = ( ) => {
48+ const downloadImage = async ( ) => {
4849 const imageBox = document . getElementById ( "export-png-image-box" ) as HTMLDivElement ;
4950 const image = imageBox . querySelector ( "img" ) as HTMLImageElement ;
5051 if ( ! image ) {
@@ -60,11 +61,12 @@ export default function ExportPNGPanel() {
6061 if ( isMac ) {
6162 try {
6263 const base64Data = image . src . split ( "," ) [ 1 ] ;
63- const filePath = `${ fileName } .png` ;
64- writeFileBase64 ( filePath , base64Data ) ;
64+ const downloadsDir = await downloadDir ( ) ;
65+ const filePath = `${ downloadsDir } /${ fileName } .png` ;
66+ await writeFileBase64 ( filePath , base64Data ) ;
6567 Dialog . show ( {
6668 title : "导出成功" ,
67- content : `图片已保存,名称为 ${ filePath } ,用访达搜索该文件可以找到它 ` ,
69+ content : `图片已保存到下载文件夹: ${ filePath } ` ,
6870 } ) ;
6971 } catch ( error ) {
7072 Dialog . show ( {
0 commit comments