From 99c53c385dddfe874ac92ce5389890716c5ee7f8 Mon Sep 17 00:00:00 2001 From: pipipi-pikachu Date: Sat, 4 Nov 2023 18:28:51 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=85=A8=E5=B1=80=E4=B8=BB=E9=A2=98?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E6=94=AF=E6=8C=81=E8=BE=B9=E6=A1=86=E3=80=81?= =?UTF-8?q?=E9=98=B4=E5=BD=B1=E7=9B=B8=E5=85=B3=E5=B1=9E=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hooks/useSlideTheme.ts | 9 +- src/mocks/theme.ts | 11 ++ src/types/slides.ts | 2 + src/views/Editor/Toolbar/SlideDesignPanel.vue | 107 +++++++++++++++++- .../Editor/Toolbar/common/ElementOutline.vue | 4 +- .../Editor/Toolbar/common/ElementShadow.vue | 4 +- 6 files changed, 130 insertions(+), 7 deletions(-) diff --git a/src/hooks/useSlideTheme.ts b/src/hooks/useSlideTheme.ts index 80188db6..d130cca9 100644 --- a/src/hooks/useSlideTheme.ts +++ b/src/hooks/useSlideTheme.ts @@ -129,9 +129,9 @@ export default () => { } // 将当前主题配置应用到全部页面 - const applyThemeToAllSlides = () => { + const applyThemeToAllSlides = (applyAll = false) => { const newSlides: Slide[] = JSON.parse(JSON.stringify(slides.value)) - const { themeColor, backgroundColor, fontColor, fontName } = theme.value + const { themeColor, backgroundColor, fontColor, fontName, outline, shadow } = theme.value for (const slide of newSlides) { if (!slide.background || slide.background.type !== 'image') { @@ -142,6 +142,11 @@ export default () => { } for (const el of slide.elements) { + if (applyAll) { + if ('outline' in el && el.outline) el.outline = outline + if ('shadow' in el && el.shadow) el.shadow = shadow + } + if (el.type === 'shape') el.fill = themeColor else if (el.type === 'line') el.color = themeColor else if (el.type === 'text') { diff --git a/src/mocks/theme.ts b/src/mocks/theme.ts index eafbdf6f..8749f692 100644 --- a/src/mocks/theme.ts +++ b/src/mocks/theme.ts @@ -5,4 +5,15 @@ export const theme: SlideTheme = { fontColor: '#333', fontName: 'Microsoft Yahei', backgroundColor: '#fff', + shadow: { + h: 3, + v: 3, + blur: 2, + color: '#808080', + }, + outline: { + width: 2, + color: '#525252', + style: 'solid', + }, } \ No newline at end of file diff --git a/src/types/slides.ts b/src/types/slides.ts index a5a8c7a5..0df49c2f 100644 --- a/src/types/slides.ts +++ b/src/types/slides.ts @@ -694,4 +694,6 @@ export interface SlideTheme { themeColor: string fontColor: string fontName: string + outline: PPTElementOutline + shadow: PPTElementShadow } diff --git a/src/views/Editor/Toolbar/SlideDesignPanel.vue b/src/views/Editor/Toolbar/SlideDesignPanel.vue index 89ecd829..cd319301 100644 --- a/src/views/Editor/Toolbar/SlideDesignPanel.vue +++ b/src/views/Editor/Toolbar/SlideDesignPanel.vue @@ -119,7 +119,14 @@ -
全局主题
+
+ 全局主题 + + 更多 + + + +
字体: