From 82d56c382de64cadd82918935ce601516dca478b Mon Sep 17 00:00:00 2001 From: pipipi-pikachu Date: Wed, 4 May 2022 12:49:22 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A4=9A=E9=80=89=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E6=89=B9=E9=87=8F=E4=BF=AE=E6=94=B9=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/Editor/EditorHeader/index.vue | 3 +- .../ElementStylePanel/MultiStylePanel.vue | 248 ++++++++++++++++++ .../Toolbar/ElementStylePanel/index.vue | 40 +-- src/views/Editor/Toolbar/index.vue | 2 +- 4 files changed, 273 insertions(+), 20 deletions(-) create mode 100644 src/views/Editor/Toolbar/ElementStylePanel/MultiStylePanel.vue diff --git a/src/views/Editor/EditorHeader/index.vue b/src/views/Editor/EditorHeader/index.vue index 8def142d..40a7f425 100644 --- a/src/views/Editor/EditorHeader/index.vue +++ b/src/views/Editor/EditorHeader/index.vue @@ -20,7 +20,7 @@ 添加页面 删除页面 {{ showGridLines ? '关闭网格线' : '打开网格线' }} - {{ toggleRuler ? '关闭标尺' : '打开标尺' }} + {{ showRuler ? '关闭标尺' : '打开标尺' }} 重置幻灯片 @@ -126,6 +126,7 @@ export default defineComponent({ redo, undo, showGridLines, + showRuler, hotkeyDrawerVisible, exportImgDialogVisible, exporting, diff --git a/src/views/Editor/Toolbar/ElementStylePanel/MultiStylePanel.vue b/src/views/Editor/Toolbar/ElementStylePanel/MultiStylePanel.vue new file mode 100644 index 00000000..60b7c224 --- /dev/null +++ b/src/views/Editor/Toolbar/ElementStylePanel/MultiStylePanel.vue @@ -0,0 +1,248 @@ + + + + + \ No newline at end of file diff --git a/src/views/Editor/Toolbar/ElementStylePanel/index.vue b/src/views/Editor/Toolbar/ElementStylePanel/index.vue index 2a8c4ede..53d6e8eb 100644 --- a/src/views/Editor/Toolbar/ElementStylePanel/index.vue +++ b/src/views/Editor/Toolbar/ElementStylePanel/index.vue @@ -1,9 +1,6 @@ @@ -22,27 +19,34 @@ import TableStylePanel from './TableStylePanel.vue' import LatexStylePanel from './LatexStylePanel.vue' import VideoStylePanel from './VideoStylePanel.vue' import AudioStylePanel from './AudioStylePanel.vue' +import MultiStylePanel from './MultiStylePanel.vue' + +const panelMap = { + [ElementTypes.TEXT]: TextStylePanel, + [ElementTypes.IMAGE]: ImageStylePanel, + [ElementTypes.SHAPE]: ShapeStylePanel, + [ElementTypes.LINE]: LineStylePanel, + [ElementTypes.CHART]: ChartStylePanel, + [ElementTypes.TABLE]: TableStylePanel, + [ElementTypes.LATEX]: LatexStylePanel, + [ElementTypes.VIDEO]: VideoStylePanel, + [ElementTypes.AUDIO]: AudioStylePanel, +} export default defineComponent({ name: 'element-style-panel', setup() { - const { handleElement } = storeToRefs(useMainStore()) + const { activeElementIdList, activeElementList, handleElement, activeGroupElementId } = storeToRefs(useMainStore()) const currentPanelComponent = computed(() => { - if (!handleElement.value) return null - - const panelMap = { - [ElementTypes.TEXT]: TextStylePanel, - [ElementTypes.IMAGE]: ImageStylePanel, - [ElementTypes.SHAPE]: ShapeStylePanel, - [ElementTypes.LINE]: LineStylePanel, - [ElementTypes.CHART]: ChartStylePanel, - [ElementTypes.TABLE]: TableStylePanel, - [ElementTypes.LATEX]: LatexStylePanel, - [ElementTypes.VIDEO]: VideoStylePanel, - [ElementTypes.AUDIO]: AudioStylePanel, + if (activeElementIdList.value.length > 1) { + if (!activeGroupElementId.value) return MultiStylePanel + + const activeGroupElement = activeElementList.value.find(item => item.id === activeGroupElementId.value) + return activeGroupElement ? (panelMap[activeGroupElement.type] || null) : null } - return panelMap[handleElement.value.type] || null + + return handleElement.value ? (panelMap[handleElement.value.type] || null) : null }) return { diff --git a/src/views/Editor/Toolbar/index.vue b/src/views/Editor/Toolbar/index.vue index 571267f3..416dcafc 100644 --- a/src/views/Editor/Toolbar/index.vue +++ b/src/views/Editor/Toolbar/index.vue @@ -61,8 +61,8 @@ export default defineComponent({ { label: '动画', value: ToolbarStates.EL_ANIMATION }, ] const multiSelectTabs = [ - { label: '位置', value: ToolbarStates.MULTI_POSITION }, { label: '样式', value: ToolbarStates.EL_STYLE }, + { label: '位置', value: ToolbarStates.MULTI_POSITION }, ] const setToolbarState = (value: ToolbarStates) => {