From 58c1ca06009f904b7cb1f39ebb2e59656a5d175b Mon Sep 17 00:00:00 2001 From: zxc <1171051090@qq.com> Date: Sun, 23 Mar 2025 17:04:36 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=AF=BC=E5=85=A5PPTX=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=20fixedViewport=20=E6=A8=A1=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hooks/useImport.ts | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/hooks/useImport.ts b/src/hooks/useImport.ts index 3fa1daf3..e20ca7ee 100644 --- a/src/hooks/useImport.ts +++ b/src/hooks/useImport.ts @@ -136,7 +136,13 @@ export default () => { } // 导入PPTX文件 - const importPPTXFile = (files: FileList, cover = false) => { + const importPPTXFile = (files: FileList, options?: { cover?: boolean; fixedViewport?: boolean }) => { + const defaultOptions = { + cover: false, + fixedViewport: false, + } + const { cover, fixedViewport } = { ...defaultOptions, ...options } + const file = files[0] if (!file) return @@ -159,10 +165,12 @@ export default () => { return } - const ratio = 96 / 72 + let ratio = 96 / 72 const width = json.size.width + + if (fixedViewport) ratio = 1000 / width + else slidesStore.setViewportSize(width * ratio) - slidesStore.setViewportSize(width * ratio) slidesStore.setTheme({ themeColors: json.themeColors }) const slides: Slide[] = []